diff options
Diffstat (limited to 'board')
112 files changed, 3252 insertions, 3908 deletions
| diff --git a/board/LaCie/net2big_v2/kwbimage.cfg b/board/LaCie/net2big_v2/kwbimage.cfg index 8d9f15328..d3904d39a 100644 --- a/board/LaCie/net2big_v2/kwbimage.cfg +++ b/board/LaCie/net2big_v2/kwbimage.cfg @@ -19,7 +19,7 @@  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  # GNU General Public License for more details.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/LaCie/netspace_v2/kwbimage-is2.cfg b/board/LaCie/netspace_v2/kwbimage-is2.cfg index 590720af8..93b803c67 100644 --- a/board/LaCie/netspace_v2/kwbimage-is2.cfg +++ b/board/LaCie/netspace_v2/kwbimage-is2.cfg @@ -19,7 +19,7 @@  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  # GNU General Public License for more details.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/LaCie/netspace_v2/kwbimage-ns2l.cfg b/board/LaCie/netspace_v2/kwbimage-ns2l.cfg index d008eb0ab..0a8a514a1 100644 --- a/board/LaCie/netspace_v2/kwbimage-ns2l.cfg +++ b/board/LaCie/netspace_v2/kwbimage-ns2l.cfg @@ -19,7 +19,7 @@  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  # GNU General Public License for more details.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/LaCie/netspace_v2/kwbimage.cfg b/board/LaCie/netspace_v2/kwbimage.cfg index 7e5364912..0cf4682fd 100644 --- a/board/LaCie/netspace_v2/kwbimage.cfg +++ b/board/LaCie/netspace_v2/kwbimage.cfg @@ -19,7 +19,7 @@  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  # GNU General Public License for more details.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/LaCie/wireless_space/kwbimage.cfg b/board/LaCie/wireless_space/kwbimage.cfg index 0daf5b539..aeddc0c8f 100644 --- a/board/LaCie/wireless_space/kwbimage.cfg +++ b/board/LaCie/wireless_space/kwbimage.cfg @@ -22,7 +22,7 @@  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  # GNU General Public License for more details.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/Marvell/dreamplug/kwbimage.cfg b/board/Marvell/dreamplug/kwbimage.cfg index ca9cd744f..e662b2df3 100644 --- a/board/Marvell/dreamplug/kwbimage.cfg +++ b/board/Marvell/dreamplug/kwbimage.cfg @@ -24,7 +24,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/Marvell/guruplug/kwbimage.cfg b/board/Marvell/guruplug/kwbimage.cfg index 2afd92746..9baf6bc78 100644 --- a/board/Marvell/guruplug/kwbimage.cfg +++ b/board/Marvell/guruplug/kwbimage.cfg @@ -21,7 +21,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/Marvell/mv88f6281gtw_ge/kwbimage.cfg b/board/Marvell/mv88f6281gtw_ge/kwbimage.cfg index ec2513f21..f74d4434e 100644 --- a/board/Marvell/mv88f6281gtw_ge/kwbimage.cfg +++ b/board/Marvell/mv88f6281gtw_ge/kwbimage.cfg @@ -21,7 +21,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/Marvell/openrd/kwbimage.cfg b/board/Marvell/openrd/kwbimage.cfg index 757eb2816..19d0bacc2 100644 --- a/board/Marvell/openrd/kwbimage.cfg +++ b/board/Marvell/openrd/kwbimage.cfg @@ -21,7 +21,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/Marvell/rd6281a/kwbimage.cfg b/board/Marvell/rd6281a/kwbimage.cfg index 0d12dd914..c8b5d74dc 100644 --- a/board/Marvell/rd6281a/kwbimage.cfg +++ b/board/Marvell/rd6281a/kwbimage.cfg @@ -21,7 +21,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/Seagate/dockstar/kwbimage.cfg b/board/Seagate/dockstar/kwbimage.cfg index 98b514ddf..4b0351dbe 100644 --- a/board/Seagate/dockstar/kwbimage.cfg +++ b/board/Seagate/dockstar/kwbimage.cfg @@ -24,7 +24,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/Seagate/goflexhome/Makefile b/board/Seagate/goflexhome/Makefile new file mode 100644 index 000000000..9948fe22d --- /dev/null +++ b/board/Seagate/goflexhome/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2013 Suriyan Ramasami <suriyan.r@gmail.com> +# +# Based on dockstar/Makefile originally written by +# Copyright (C) 2010  Eric C. Cooper <ecc@cmu.edu> +# +# Based on sheevaplug/Makefile originally written by +# Prafulla Wadaskar <prafulla@marvell.com> +# (C) Copyright 2009 +# Marvell Semiconductor <www.marvell.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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# + +include $(TOPDIR)/config.mk + +LIB	= $(obj)lib$(BOARD).o + +COBJS	:= goflexhome.o + +SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS	:= $(addprefix $(obj),$(COBJS)) +SOBJS	:= $(addprefix $(obj),$(SOBJS)) + +$(LIB):	$(obj).depend $(OBJS) $(SOBJS) +	$(call cmd_link_o_target, $(OBJS) $(SOBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/Seagate/goflexhome/goflexhome.c b/board/Seagate/goflexhome/goflexhome.c new file mode 100644 index 000000000..17c19053f --- /dev/null +++ b/board/Seagate/goflexhome/goflexhome.c @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2013 Suriyan Ramasami <suriyan.r@gmail.com> + * + * Based on dockstar.c originally written by + * Copyright (C) 2010  Eric C. Cooper <ecc@cmu.edu> + * + * Based on sheevaplug.c originally written by + * Prafulla Wadaskar <prafulla@marvell.com> + * (C) Copyright 2009 + * Marvell Semiconductor <www.marvell.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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include <common.h> +#include <miiphy.h> +#include <asm/arch/kirkwood.h> +#include <asm/arch/mpp.h> +#include <asm/arch/cpu.h> +#include <asm/io.h> + +DECLARE_GLOBAL_DATA_PTR; + +int board_early_init_f(void) +{ +	/* Multi-Purpose Pins Functionality configuration */ +	static const u32 kwmpp_config[] = { +		MPP0_NF_IO2, +		MPP1_NF_IO3, +		MPP2_NF_IO4, +		MPP3_NF_IO5, +		MPP4_NF_IO6, +		MPP5_NF_IO7, +		MPP6_SYSRST_OUTn, +		MPP7_GPO, +		MPP8_UART0_RTS, +		MPP9_UART0_CTS, +		MPP10_UART0_TXD, +		MPP11_UART0_RXD, +		MPP12_SD_CLK, +		MPP13_SD_CMD, +		MPP14_SD_D0, +		MPP15_SD_D1, +		MPP16_SD_D2, +		MPP17_SD_D3, +		MPP18_NF_IO0, +		MPP19_NF_IO1, +		MPP20_GPIO, +		MPP21_GPIO, +		MPP22_GPIO, +		MPP23_GPIO, +		MPP24_GPIO, +		MPP25_GPIO, +		MPP26_GPIO, +		MPP27_GPIO, +		MPP28_GPIO, +		MPP29_TSMP9, +		MPP30_GPIO, +		MPP31_GPIO, +		MPP32_GPIO, +		MPP33_GPIO, +		MPP34_GPIO, +		MPP35_GPIO, +		MPP36_GPIO, +		MPP37_GPIO, +		MPP38_GPIO, +		MPP39_GPIO, +		MPP40_GPIO, +		MPP41_GPIO, +		MPP42_GPIO, +		MPP43_GPIO, +		MPP44_GPIO, +		MPP45_GPIO, +		MPP46_GPIO, +		MPP47_GPIO, +		MPP48_GPIO, +		MPP49_GPIO, +		0 +	}; + +	/* +	 * default gpio configuration +	 * There are maximum 64 gpios controlled through 2 sets of registers +	 * the  below configuration configures mainly initial LED status +	 */ +	kw_config_gpio(GOFLEXHOME_OE_VAL_LOW, +		       GOFLEXHOME_OE_VAL_HIGH, +		       GOFLEXHOME_OE_LOW, GOFLEXHOME_OE_HIGH); +	kirkwood_mpp_conf(kwmpp_config, NULL); +	return 0; +} + +int board_init(void) +{ +	/* +	 * arch number of board +	 */ +	gd->bd->bi_arch_number = MACH_TYPE_GOFLEXHOME; + +	/* address of boot parameters */ +	gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100; + +	return 0; +} + +#ifdef CONFIG_RESET_PHY_R +/* Configure and enable MV88E1116 PHY */ +void reset_phy(void) +{ +	u16 reg; +	u16 devadr; +	char *name = "egiga0"; + +	if (miiphy_set_current_dev(name)) +		return; + +	/* command to read PHY dev address */ +	if (miiphy_read(name, 0xEE, 0xEE, (u16 *)&devadr)) { +		printf("Err..%s could not read PHY dev address\n", +		       __func__); +		return; +	} + +	/* +	 * Enable RGMII delay on Tx and Rx for CPU port +	 * Ref: sec 4.7.2 of chip datasheet +	 */ +	miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2); +	miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®); +	reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); +	miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg); +	miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0); + +	/* reset the phy */ +	miiphy_reset(name, devadr); + +	printf("88E1116 Initialized on %s\n", name); +} +#endif /* CONFIG_RESET_PHY_R */ + +#define GREEN_LED	(1 << 14) +#define ORANGE_LED	(1 << 15) +#define BOTH_LEDS	(GREEN_LED | ORANGE_LED) +#define NEITHER_LED	0 + +static void set_leds(u32 leds, u32 blinking) +{ +	struct kwgpio_registers *r; +	u32 oe; +	u32 bl; + +	r = (struct kwgpio_registers *)KW_GPIO1_BASE; +	oe = readl(&r->oe) | BOTH_LEDS; +	writel(oe & ~leds, &r->oe);	/* active low */ +	bl = readl(&r->blink_en) & ~BOTH_LEDS; +	writel(bl | blinking, &r->blink_en); +} + +void show_boot_progress(int val) +{ +	switch (val) { +	case BOOTSTAGE_ID_RUN_OS:		/* booting Linux */ +		set_leds(BOTH_LEDS, NEITHER_LED); +		break; +	case BOOTSTAGE_ID_NET_ETH_START:	/* Ethernet initialization */ +		set_leds(GREEN_LED, GREEN_LED); +		break; +	default: +		if (val < 0)	/* error */ +			set_leds(ORANGE_LED, ORANGE_LED); +		break; +	} +} diff --git a/board/Seagate/goflexhome/kwbimage.cfg b/board/Seagate/goflexhome/kwbimage.cfg new file mode 100644 index 000000000..e984d7224 --- /dev/null +++ b/board/Seagate/goflexhome/kwbimage.cfg @@ -0,0 +1,168 @@ +# +# Copyright (C) 2013 Suriyan Ramasami <suriyan.r@gmail.com> +# +# Based on dockstar/kwbimage.cfg originally written by +# Copyright (C) 2010  Eric C. Cooper <ecc@cmu.edu> +# +# Based on sheevaplug/kwbimage.cfg originally written by +# Prafulla Wadaskar <prafulla@marvell.com> +# (C) Copyright 2009 +# Marvell Semiconductor <www.marvell.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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +# Refer docs/README.kwimage for more details about how-to configure +# and create kirkwood boot image +# + +# Boot Media configurations +BOOT_FROM	nand +NAND_ECC_MODE	default +NAND_PAGE_SIZE	0x0800 + +# SOC registers configuration using bootrom header extension +# Maximum KWBIMAGE_MAX_CONFIG configurations allowed + +# Configure RGMII-0 interface pad voltage to 1.8V +DATA 0xFFD100e0 0x1b1b1b9b + +#Dram initalization for SINGLE x16 CL=5 @ 400MHz +DATA 0xFFD01400 0x43000c30	# DDR Configuration register +# bit13-0:  0xc30 (3120 DDR2 clks refresh rate) +# bit23-14: zero +# bit24: 1= enable exit self refresh mode on DDR access +# bit25: 1 required +# bit29-26: zero +# bit31-30: 01 + +DATA 0xFFD01404 0x37543000	# DDR Controller Control Low +# bit 4:    0=addr/cmd in smame cycle +# bit 5:    0=clk is driven during self refresh, we don't care for APX +# bit 6:    0=use recommended falling edge of clk for addr/cmd +# bit14:    0=input buffer always powered up +# bit18:    1=cpu lock transaction enabled +# bit23-20: 5=recommended value for CL=5 and STARTBURST_DEL disabled bit31=0 +# bit27-24: 7= CL+2, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM +# bit30-28: 3 required +# bit31:    0=no additional STARTBURST delay + +DATA 0xFFD01408 0x22125451	# DDR Timing (Low) (active cycles value +1) +# bit3-0:   TRAS lsbs +# bit7-4:   TRCD +# bit11- 8: TRP +# bit15-12: TWR +# bit19-16: TWTR +# bit20:    TRAS msb +# bit23-21: 0x0 +# bit27-24: TRRD +# bit31-28: TRTP + +DATA 0xFFD0140C 0x00000a33	#  DDR Timing (High) +# bit6-0:   TRFC +# bit8-7:   TR2R +# bit10-9:  TR2W +# bit12-11: TW2W +# bit31-13: zero required + +DATA 0xFFD01410 0x0000000d	#  DDR Address Control +# bit1-0:   00, Cs0width=x8 +# bit3-2:   11, Cs0size=1Gb +# bit5-4:   00, Cs1width=nonexistent +# bit7-6:   00, Cs1size =nonexistent +# bit9-8:   00, Cs2width=nonexistent +# bit11-10: 00, Cs2size =nonexistent +# bit13-12: 00, Cs3width=nonexistent +# bit15-14: 00, Cs3size =nonexistent +# bit16:    0,  Cs0AddrSel +# bit17:    0,  Cs1AddrSel +# bit18:    0,  Cs2AddrSel +# bit19:    0,  Cs3AddrSel +# bit31-20: 0 required + +DATA 0xFFD01414 0x00000000	#  DDR Open Pages Control +# bit0:    0,  OpenPage enabled +# bit31-1: 0 required + +DATA 0xFFD01418 0x00000000	#  DDR Operation +# bit3-0:   0x0, DDR cmd +# bit31-4:  0 required + +DATA 0xFFD0141C 0x00000C52	#  DDR Mode +# bit2-0:   2, BurstLen=2 required +# bit3:     0, BurstType=0 required +# bit6-4:   4, CL=5 +# bit7:     0, TestMode=0 normal +# bit8:     0, DLL reset=0 normal +# bit11-9:  6, auto-precharge write recovery ???????????? +# bit12:    0, PD must be zero +# bit31-13: 0 required + +DATA 0xFFD01420 0x00000040	#  DDR Extended Mode +# bit0:    0,  DDR DLL enabled +# bit1:    0,  DDR drive strenght normal +# bit2:    0,  DDR ODT control lsd (disabled) +# bit5-3:  000, required +# bit6:    1,  DDR ODT control msb, (disabled) +# bit9-7:  000, required +# bit10:   0,  differential DQS enabled +# bit11:   0, required +# bit12:   0, DDR output buffer enabled +# bit31-13: 0 required + +DATA 0xFFD01424 0x0000F17F	#  DDR Controller Control High +# bit2-0:  111, required +# bit3  :  1  , MBUS Burst Chop disabled +# bit6-4:  111, required +# bit7  :  0 +# bit8  :  1  , add writepath sample stage, must be 1 for DDR freq >= 300MHz +# bit9  :  0  , no half clock cycle addition to dataout +# bit10 :  0  , 1/4 clock cycle skew enabled for addr/ctl signals +# bit11 :  0  , 1/4 clock cycle skew disabled for write mesh +# bit15-12: 1111 required +# bit31-16: 0    required + +DATA 0xFFD01428 0x00085520	# DDR2 ODT Read Timing (default values) +DATA 0xFFD0147C 0x00008552	# DDR2 ODT Write Timing (default values) + +DATA 0xFFD01500 0x00000000	# CS[0]n Base address to 0x0 +DATA 0xFFD01504 0x07FFFFF1	# CS[0]n Size +# bit0:    1,  Window enabled +# bit1:    0,  Write Protect disabled +# bit3-2:  00, CS0 hit selected +# bit23-4: ones, required +# bit31-24: 0x07, Size (i.e. 128MB) + +DATA 0xFFD01508 0x10000000	# CS[1]n Base address to 256Mb +DATA 0xFFD0150C 0x00000000	# CS[1]n Size, window disabled + +DATA 0xFFD01514 0x00000000	# CS[2]n Size, window disabled +DATA 0xFFD0151C 0x00000000	# CS[3]n Size, window disabled + +DATA 0xFFD01494 0x00030000	#  DDR ODT Control (Low) +DATA 0xFFD01498 0x00000000	#  DDR ODT Control (High) +# bit1-0:  00, ODT0 controlled by ODT Control (low) register above +# bit3-2:  01, ODT1 active NEVER! +# bit31-4: zero, required + +DATA 0xFFD0149C 0x0000E803	# CPU ODT Control +DATA 0xFFD01480 0x00000001	# DDR Initialization Control +#bit0=1, enable DDR init upon this register write + +# End of Header extension +DATA 0x0 0x0 diff --git a/board/alaska/README b/board/alaska/README deleted file mode 100644 index 334507397..000000000 --- a/board/alaska/README +++ /dev/null @@ -1,482 +0,0 @@ -Freescale Alaska MPC8220 board -============================== - -TsiChung Liew(Tsi-Chung.Liew@freescale.com) -Created 9/21/04 -=========================================== - - -Changed files: -============== - -- Makefile		    added MPC8220 and Alaska8220_config -- MAKEALL		    added MPC8220 and Alaska8220 -- README		    added CONFIG_MPC8220, Alaska8220_config - -- common/cmd_bdinfo.c	    added board information members for MPC8220 -- common/cmd_bootm.c	    added clocks for MPC8220 in do_bootm_linux() - -- include/common.h	    added CONFIG_MPC8220 - -- include/asm-ppc/u-boot.h  added board information members for MPC8220 -- include/asm-ppc/global_data.h added global variables - inp_clk, pci_clk, -			    vco_clk, pev_clk, flb_clk, and bExtUart - -- arch/powerpc/lib/board.c	    added CONFIG_MPC8220 support - -- net/eth.c		    added FEC support for MPC8220 - -Added files: -============ -- board/alaska		    directory for Alaska MPC8220 -- board/alaska/alaska.c	    Alaska dram and BATs setup -- board/alaska/extserial.c  external serial (debug card serial) support -- board/alaska/flash.c	    Socket (AMD) and Onboard (INTEL) flash support -- board/alaska/serial.c	    to determine which int/ext serial to use -- board/alaska/Makefile	    Makefile -- board/alaska/config.mk    config make -- board/alaska/u-boot.lds   Linker description - -- arch/powerpc/cpu/mpc8220/dma.h	    multi-channel dma header file -- arch/powerpc/cpu/mpc8220/dramSetup.h   dram setup header file -- arch/powerpc/cpu/mpc8220/fec.h	    MPC8220 FEC header file -- arch/powerpc/cpu/mpc8220/cpu.c	    cpu specific code -- arch/powerpc/cpu/mpc8220/cpu_init.c    Flexbus ChipSelect and Mux pins setup -- arch/powerpc/cpu/mpc8220/dramSetup.c   MPC8220 DDR SDRAM setup -- arch/powerpc/cpu/mpc8220/fec.c	    MPC8220 FEC driver -- arch/powerpc/cpu/mpc8220/i2c.c	    MPC8220 I2C driver -- arch/powerpc/cpu/mpc8220/interrupts.c  interrupt support (not enable) -- arch/powerpc/cpu/mpc8220/loadtask.c    load dma -- arch/powerpc/cpu/mpc8220/speed.c	    system, pci, flexbus, pev, and cpu clock -- arch/powerpc/cpu/mpc8220/traps.c	    exception -- arch/powerpc/cpu/mpc8220/uart.c	    MPC8220 UART driver -- arch/powerpc/cpu/mpc8220/Makefile	    Makefile -- arch/powerpc/cpu/mpc8220/config.mk	    config make -- arch/powerpc/cpu/mpc8220/fec_dma_task.S MPC8220 FEC multi-channel dma program -- arch/powerpc/cpu/mpc8220/io.S	    io functions -- arch/powerpc/cpu/mpc8220/start.S	    start up - -- include/mpc8220.h - -- include/asm-ppc/immap_8220.h - -- include/configs/Alaska8220.h - - -1. SWITCH SETTINGS -================== -1.1 SW1: 0 - Boot from Socket Flash (AMD) or 1 - Onboard Flash (INTEL) -    SW2: 0 - Select MPC8220 UART or 1 - Debug Card UART -    SW3: unsed -    SW4: 0 - 1284 or 1 - FEC1 -    SW5: 0 - PEV or 1 - FEC2 - - -2. MEMORY MAP UNDER U-BOOT AND LINUX KERNEL -=========================================== -2.1. For the initial bringup, we adopted a consistent memory scheme between u-boot and -     linux kernel, you can customize it based on your system requirements: -      DDR:	    0x00000000-0x1fffffff (max 512MB) -      MBAR:	    0xf0000000-0xf0027fff (128KB) -      CPLD:	    0xf1000000-0xf103ffff (256KB) -      FPGA:	    0xf2000000-0xf203ffff (256KB) -      Flash:	    0xfe000000-0xffffffff (max 32MB) - -3. DEFINITIONS AND COMPILATION -============================== -3.1 Explanation on NEW definitions in include/configs/alaska8220.h -    CONFIG_MPC8220	    MPC8220 specific -    CONFIG_ALASKA8220	    Alaska board specific -    CONFIG_SYS_MPC8220_CLKIN	    Define Alaska Input Clock -    CONFIG_PSC_CONSOLE	    Enable MPC8220 UART -    CONFIG_EXTUART_CONSOLE  Enable External 16552 UART -    CONFIG_SYS_AMD_BOOT	    To determine the u-boot is booted from AMD or Intel -    CONFIG_SYS_MBAR		    MBAR base address -    CONFIG_SYS_DEFAULT_MBAR	    Reset MBAR base address - -3.2 Compilation -   export CROSS_COMPILE=cross-compile-prefix -   cd u-boot-1-1-x -   make distclean -   make Alaska8220_config -   make - - -4. SCREEN DUMP -============== -4.1 Alaska MPC8220 board -    Boot from AMD (NOTE: May not show exactly the same) - -U-Boot 1.1.1 (Sep 22 2004 - 22:14:41) - -CPU:   MPC8220 (JTAG ID 1640301d) at 300 MHz -       Bus 120 MHz, CPU 300 MHz, PCI 30 MHz, VCO 480 MHz -Board: Alaska MPC8220 Evaluation Board -I2C:   93 kHz, ready -DRAM:  256 MB -Reserving 167k for U-Boot at: 0ffd6000 -FLASH: 16.5 MB -*** Warning - bad CRC, using default environment - -In:    serial -Out:   serial -Err:   serial -Net:   FEC ETHERNET -=> flinfo - -Bank # 1: INTEL 28F128J3A -  Size: 8 MB in 64 Sectors -  Sector Start Addresses: -    FE000000	  FE020000	FE040000      FE060000	    FE080000 -    FE0A0000	  FE0C0000	FE0E0000      FE100000	    FE120000 -    FE140000	  FE160000	FE180000      FE1A0000	    FE1C0000 -    FE1E0000	  FE200000	FE220000      FE240000	    FE260000 -    FE280000	  FE2A0000	FE2C0000      FE2E0000	    FE300000 -    FE320000	  FE340000	FE360000      FE380000	    FE3A0000 -    FE3C0000	  FE3E0000	FE400000      FE420000	    FE440000 -    FE460000	  FE480000	FE4A0000      FE4C0000	    FE4E0000 -    FE500000	  FE520000	FE540000      FE560000	    FE580000 -    FE5A0000	  FE5C0000	FE5E0000      FE600000	    FE620000 -    FE640000	  FE660000	FE680000      FE6A0000	    FE6C0000 -    FE6E0000	  FE700000	FE720000      FE740000	    FE760000 -    FE780000	  FE7A0000	FE7C0000      FE7E0000 - -Bank # 2: INTEL 28F128J3A -  Size: 8 MB in 64 Sectors -  Sector Start Addresses: -    FE800000	  FE820000	FE840000      FE860000	    FE880000 -    FE8A0000	  FE8C0000	FE8E0000      FE900000	    FE920000 -    FE940000	  FE960000	FE980000      FE9A0000	    FE9C0000 -    FE9E0000	  FEA00000	FEA20000      FEA40000	    FEA60000 -    FEA80000	  FEAA0000	FEAC0000      FEAE0000	    FEB00000 -    FEB20000	  FEB40000	FEB60000      FEB80000	    FEBA0000 -    FEBC0000	  FEBE0000	FEC00000      FEC20000	    FEC40000 -    FEC60000	  FEC80000	FECA0000      FECC0000	    FECE0000 -    FED00000	  FED20000	FED40000      FED60000	    FED80000 -    FEDA0000	  FEDC0000	FEDE0000      FEE00000	    FEE20000 -    FEE40000	  FEE60000	FEE80000      FEEA0000	    FEEC0000 -    FEEE0000	  FEF00000 (RO) FEF20000 (RO) FEF40000	    FEF60000 -    FEF80000	  FEFA0000	FEFC0000      FEFE0000 (RO) - -Bank # 3: AMD AMD29F040B -  Size: 0 MB in 7 Sectors -  Sector Start Addresses: -    FFF00000 (RO) FFF10000 (RO) FFF20000 (RO) FFF30000	    FFF40000 -    FFF50000	  FFF60000 - -Bank # 4: AMD AMD29F040B -  Size: 0 MB in 1 Sectors -  Sector Start Addresses: -    FFF70000 (RO) -=> bdinfo - -memstart    = 0xF0009800 -memsize	    = 0x10000000 -flashstart  = 0xFFF00000 -flashsize   = 0x01080000 -flashoffset = 0x00025000 -sramstart   = 0xF0020000 -sramsize    = 0x00008000 -bootflags   = 0x00000001 -intfreq	    =	 300 MHz -busfreq	    =	 120 MHz -inpfreq	    =	  30 MHz -flbfreq	    =	  30 MHz -pcifreq	    =	  30 MHz -vcofreq	    =	 480 MHz -pevfreq	    =	  81 MHz -ethaddr	    = 00:E0:0C:BC:E0:60 -eth1addr    = 00:E0:0C:BC:E0:61 -IP addr	    = 192.162.1.2 -baudrate    = 115200 bps -=> printenv -bootargs=root=/dev/ram rw -bootdelay=5 -baudrate=115200 -ethaddr=00:e0:0c:bc:e0:60 -eth1addr=00:e0:0c:bc:e0:61 -ipaddr=192.162.1.2 -serverip=192.162.1.1 -gatewayip=192.162.1.1 -netmask=255.255.255.0 -hostname=Alaska -stdin=serial -stdout=serial -stderr=serial -ethact=FEC ETHERNET - -Environment size: 268/65532 bytes -=> setenv ipaddr 192.160.1.2 -=> setenv serverip 192.160.1.1 -=> setenv gatewayip 192.160.1.1 -=> saveenv -Saving Environment to Flash... - -. -Un-Protected 1 sectors -Erasing Flash... -Erasing sector	0 ...  done -Erased 1 sectors -Writing to Flash... done - -. -Protected 1 sectors -=> tftp 0x10000 linux.elf -Using FEC ETHERNET device -TFTP from server 192.160.1.1; our IP address is 192.160.1.2; sending through gateway 192.160.1.1 -Filename 'linux.elf'. -Load address: 0x10000 -Loading: invalid RARP header -################################################################# -	 ################################################################# -	 ################################################################# -	 ################################################################# -	 ################################################################# -	 ################################################################# -	 ################################################################# -	 ################################################################# -	 ################################################## -done -Bytes transferred = 2917494 (2c8476 hex) -=> bootelf -Loading .text @ 0x00a00000 (23820 bytes) -Loading .data @ 0x00a06000 (2752512 bytes) -Clearing .bss @ 0x00ca6000 (12764 bytes) -## Starting application at 0x00a00000 ... - -Collect some entropy from RAM........done -loaded at:     00A00000 00CA91DC -zimage at:     00A06A93 00AD7756 -initrd at:     00AD8000 00CA5565 -avail ram:     00CAA000 014AA000 - -Linux/PPC load: ip=off console=ttyS0,115200 -Uncompressing Linux...done. -Now booting the kernel -Total memory in system: 256 MB -Memory BAT mapping: BAT2=256Mb, BAT3=0Mb, residual: 0Mb -Linux version 2.4.21-rc1 (r61688@bluesocks.sps.mot.com) (gcc version 3.3.1) #17 Wed Sep 8 11:49:16 CDT 2004 -Motorola Alaska port (C) 2003 Motorola, Inc. -CPLD rev 3 -CPLD switches 0x1b -Set Pin Mux for FEC1 -Set Pin Mux for FEC2 -Alaska Pin Multiplexing: -Port Configuration Register 0 = 0 -Port Configuration Register 1 = 0 -Port Configuration Register 2 = 0 -Port Configuration Register 3 = 50000000 -Port Configuration Register 3 - PCI = 51400180 -Setup Alaska FPGA PIC: -Interrupt Enable Register *(u32) = 0 -Interrupt Status Register = 2f0000 -Interrupt Enable Register in_be32 = 0 -Interrupt Status Register = 2f0000 -Interrupt Enable Register in_le32 = 0 -Interrupt Status Register = 2f00 -Interrupt Enable Register readl = 0 -Interrupt Status Register = 2f00 -Interrupt Enable Register = 0 -Interrupt Status Register = 2f0000 -Setup Alaska PCI Controller: -On node 0 totalpages: 65536 -zone(0): 65536 pages. -zone(1): 0 pages. -zone(2): 0 pages. -Kernel command line: ip=off console=ttyS0,115200 -Using XLB clock (120.00 MHz) to set up decrementer -Calibrating delay loop... 199.88 BogoMIPS -Memory: 254792k available (1476k kernel code, 708k data, 228k init, 0k highmem) -Dentry cache hash table entries: 32768 (order: 6, 262144 bytes) -Inode cache hash table entries: 16384 (order: 5, 131072 bytes) -Mount cache hash table entries: 512 (order: 0, 4096 bytes) -Buffer-cache hash table entries: 16384 (order: 4, 65536 bytes) -Page-cache hash table entries: 65536 (order: 6, 262144 bytes) -POSIX conformance testing by UNIFIX -PCI: Probing PCI hardware -PCI: (pcibios_init) Global-Hose = 0xc029d000 -Scanning bus 00 -Fixups for bus 00 -Bus scan for 00 returning with max=00 -PCI: (pcibios_init) finished pci_scan_bus(hose->first_busno = 0, hose->ops = c01a1a74, hose = c029d000) -PCI: (pcibios_init) PCI Bus Count = 0 =?= Next Bus# = 1 -PCI: (pcibios_init@pci_fixup_irqs) finished machine dependent PCI interrupt routing! -PCI: bridge rsrc 81000000..81ffffff (100), parent c01a7f88 -PCI: bridge rsrc 84000000..87ffffff (200), parent c01a7fa4 -PCI: (pcibios_init) finished allocating and assigning resources! -initDma! -Using 90 DMA buffer descriptors -descUsed f0023600, descriptors f002360c freeSram f0024140 -unmask SDMA tasks: 0xf0008018 = 0x6f000000 -Linux NET4.0 for Linux 2.4 -Based upon Swansea University Computer Society NET3.039 -Initializing RT netlink socket -Starting kswapd -Journalled Block Device driver loaded -JFFS version 1.0, (C) 1999, 2000  Axis Communications AB -JFFS2 version 2.1. (C) 2001 Red Hat, Inc., designed by Axis Communications AB. -pty: 256 Unix98 ptys configured -tracek: Copyright (C) Motorola, 2003. -Serial driver version 5.05c (2001-07-08) with MANY_PORTS SHARE_IRQ SERIAL_PCI enabled -ttyS00 at 0xf1001008 (irq = 73) is a ST16650 -ttyS01 at 0xf1001010 (irq = 74) is a ST16650 -elp-fpanel: Copyright (C) Motorola, 2003. -fpanel: fpanelWait timeout -elp-engine: Copyright (C) Motorola, 2003. -Video disabled due to configuration switch 4 -Alpine 1284 driver: Copyright (C) Motorola, 2003. -1284 disabled due to configuration switch 5 -Alpine USB driver: Copyright (C) Motorola, 2003. -OK -USB: Descriptor download completed OK -enable_irq(41) unbalanced -enable_irq(75) unbalanced -elp-dmaram: Copyright (C) Motorola, 2003. -Total memory in system: 256 MB -elp_dmaram: offset is 0x10000000, size is 0 -Xicor NVRAM driver: Copyright (C) Motorola, 2003. -elp-video: Copyright (C) Motorola, 2003. -Video disabled due to configuration switch 4 -elp-pfm: Copyright (C) Motorola, 2003. -paddle: Copyright (C) Motorola, 2001, present. -RAMDISK driver initialized: 16 RAM disks of 12288K size 1024 blocksize -loop: loaded (max 8 devices) -PPP generic driver version 2.4.2 -PPP Deflate Compression module registered -Uniform Multi-Platform E-IDE driver Revision: 7.00beta-2.4 -ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx -init_alaska_mtd: chip probing count 0 -cfi_cmdset_0001: Erase suspend on write enabled -Using buffer write method -init_alaska_mtd: bank1, name:ALASKA0, size:16777216bytes -ALASKA flash0: Using Static image partition definition -Creating 3 MTD partitions on "ALASKA0": -0x00000000-0x00280000 : "kernel" -0x00280000-0x00fe0000 : "user" -0x00fe0000-0x01000000 : "signature" -mgt_fec_module_init -mgt_fec_init() -mgt_fec_init -mgt_init_fec_dev(0xc05f6000,0) -dev c05f6000 fec_priv c05f6160 fec f0009000 -mgt_init_fec_dev(0xc05f6800,1) -dev c05f6800 fec_priv c05f6960 fec f0009800 -NET4: Linux TCP/IP 1.0 for NET4.0 -IP Protocols: ICMP, UDP, TCP, IGMP -IP: routing cache hash table of 2048 buckets, 16Kbytes -TCP: Hash tables configured (established 16384 bind 32768) -NET4: Unix domain sockets 1.0/SMP for Linux NET4.0. -RAMDISK: Compressed image found at block 0 -Freeing initrd memory: 1845k freed -JFFS: Trying to mount a non-mtd device. -VFS: Mounted root (romfs filesystem) readonly. -Freeing unused kernel memory: 228k init -INIT: version 2.78 booting -INIT: Entering runlevel: 1 -"Space, a great big place of unknown stuff."  -Dexter, for our MotD. -[01/Jan/1970:00:00:01 +0000] boa: server version Boa/0.94.8.3 -[01/Jan/1970:00:00:01 +0000] boa: server built Sep  7 2004 at 17:40:55. -[01/Jan/1970:00:00:01 +0000] boa: starting server pid=28, port 80 -Mounting flash filesystem, will take a minute... -/etc/rc: line 30: /dev/lp0: No such devish-2.05b# -sh-2.05b# ifup eth0 -client (v0.9.9-pre) started -adapter index 2 -adapter hardware address 00:e0:0c:bc:e0:60 -execle'ing /usr/share/udhcpc/default.script -/sbin/ifconfig eth0 -eth0	  Link encap:Ethernet  HWaddr 00:E0:0C:BC:E0:60 -	  BROADCAST MULTICAST  MTU:1500	 Metric:1 -	 mgt_fec_open - Rfec request irq -X fec_open: rcv_ring_size 8, xmt_ring_size 8 -packmgt_fec_open(): call netif_start_queue() -ets:0 errors:0 dropped:0 overruns:0 frame:0 -	  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 -	  collisions:0 txqueuelen:100 -	  RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b) -	  Base address:0x9000 - -/sbin/ifconfig eth0 up -entering raw listen mode -Opening raw socket on ifindex 2 -adding option 0x35 -adding option 0x3d -adding option 0x3c -Sending discover... -Waiting on select... -unrelated/bogus packet -Waiting on select... -oooooh!!! got some! -adding option 0x35 -adding option 0x3d -adding option 0x3c -adding option 0x32 -adding option 0x36 -Sending select for 163.12.48.146... -Waiting on select... -oooooh!!! got some! -Waiting on select... -oooooh!!! got some! -Lease of 163.12.48.146 obtained, lease time 345600 -execle'ing /usr/share/udhcpc/default.script -/sbin/ifconfig eth0 163.12.48.146 netmask 255.255.254.0 -/sbin/ifconfig eth0 up -deleting routers -/sbin/route del default -/sbin/route add default gw 163.12.49.254 dev eth0 -adding dns 163.12.252.230 -adding dns 192.55.22.4 -adding dns 192.5.249.4 -entering none listen mode -sh-2.05b# - -5. REPROGRAM U-BOOT -=================== -5.1 Reprogram u-boot (boot from AMD) -    1. Unprotect the boot sector -    => protect off bank 3 -    2. Download new u-boot binary file -    => tftp 0x10000 u-boot.bin -    3. Erase bootsector (max 7 sectors) -    => erase 0xfff00000 0xfff6ffff -    4. Program the u-boot to flash -    => cp.b 0x10000 0xfff00000 -    5. Reset for the new u-boot to take place -    => reset - -5.2 Reprogram u-boot (boot from AMD program at INTEL) -    1. Unprotect the boot sector -    => protect off bank 2 -    2. Download new u-boot binary file -    => tftp 0x10000 u-boot.bin -    3. Erase bootsector (max 7 sectors) -    => erase 0xfef00000 0xfefdffff -    4. Program the u-boot to flash -    => cp.b 0x10000 0xfef00000 -    5. Reset for the new u-boot to take place -    => reset - -5.3 Reprogram u-boot (boot from INTEL) -    1. Unprotect the boot sector -    => protect off bank 4 -    2. Download new u-boot binary file -    => tftp 0x10000 u-boot.bin -    3. Erase bootsector (max 7 sectors) -    => erase 0xfff00000 0xfffdffff -    4. Program the u-boot to flash -    => cp.b 0x10000 0xfff00000 -    5. Reset for the new u-boot to take place -    => reset - -5.4 Reprogram u-boot (boot from INTEL program at AMD) -    1. Unprotect the boot sector -    => protect off bank 1 -    2. Download new u-boot binary file -    => tftp 0x10000 u-boot.bin -    3. Erase bootsector (max 7 sectors) -    => erase 0xfe080000 0xfe0effff -    4. Program the u-boot to flash -    => cp.b 0x10000 0xfe080000 -    5. Reset for the new u-boot to take place -    => reset diff --git a/board/alaska/alaska.c b/board/alaska/alaska.c deleted file mode 100644 index 89c1abd23..000000000 --- a/board/alaska/alaska.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * (C) Copyright 2004, Freescale Inc. - * TsiChung Liew, Tsi-Chung.Liew@freescale.com - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> -#include <mpc8220.h> -#include <asm/processor.h> -#include <asm/mmu.h> - -void setupBat (ulong size) -{ -	ulong batu, batl; -	int blocksize = 0; - -	/* Flash 0 */ -#if defined (CONFIG_SYS_AMD_BOOT) -	batu = CONFIG_SYS_FLASH0_BASE | BATU_BL_512K | BPP_RW | BPP_RX; -#else -	batu = CONFIG_SYS_FLASH0_BASE | BATU_BL_16M | BPP_RW | BPP_RX; -#endif -	batl = CONFIG_SYS_FLASH0_BASE | 0x22; -	write_bat (IBAT0, batu, batl); -	write_bat (DBAT0, batu, batl); - -	/* Flash 1 */ -#if defined (CONFIG_SYS_AMD_BOOT) -	batu = CONFIG_SYS_FLASH1_BASE | BATU_BL_16M | BPP_RW | BPP_RX; -#else -	batu = CONFIG_SYS_FLASH1_BASE | BATU_BL_512K | BPP_RW | BPP_RX; -#endif -	batl = CONFIG_SYS_FLASH1_BASE | 0x22; -	write_bat (IBAT1, batu, batl); -	write_bat (DBAT1, batu, batl); - -	/* CPLD */ -	batu = CONFIG_SYS_CPLD_BASE | BATU_BL_512K | BPP_RW | BPP_RX; -	batl = CONFIG_SYS_CPLD_BASE | 0x22; -	write_bat (IBAT2, 0, 0); -	write_bat (DBAT2, batu, batl); - -	/* FPGA */ -	batu = CONFIG_SYS_FPGA_BASE | BATU_BL_512K | BPP_RW | BPP_RX; -	batl = CONFIG_SYS_FPGA_BASE | 0x22; -	write_bat (IBAT3, 0, 0); -	write_bat (DBAT3, batu, batl); - -	/* MBAR - Data only */ -	batu = CONFIG_SYS_MBAR | BPP_RW | BPP_RX; -	batl = CONFIG_SYS_MBAR | 0x22; -	mtspr (IBAT4L, 0); -	mtspr (IBAT4U, 0); -	mtspr (DBAT4L, batl); -	mtspr (DBAT4U, batu); - -	/* MBAR - SRAM */ -	batu = CONFIG_SYS_SRAM_BASE | BPP_RW | BPP_RX; -	batl = CONFIG_SYS_SRAM_BASE | 0x42; -	mtspr (IBAT5L, batl); -	mtspr (IBAT5U, batu); -	mtspr (DBAT5L, batl); -	mtspr (DBAT5U, batu); - -	if (size <= 0x800000)	/* 8MB */ -		blocksize = BATU_BL_8M; -	else if (size <= 0x1000000)	/* 16MB */ -		blocksize = BATU_BL_16M; -	else if (size <= 0x2000000)	/* 32MB */ -		blocksize = BATU_BL_32M; -	else if (size <= 0x4000000)	/* 64MB */ -		blocksize = BATU_BL_64M; -	else if (size <= 0x8000000)	/* 128MB */ -		blocksize = BATU_BL_128M; -	else if (size <= 0x10000000)	/* 256MB */ -		blocksize = BATU_BL_256M; - -	/* Memory */ -	batu = CONFIG_SYS_SDRAM_BASE | blocksize | BPP_RW | BPP_RX; -	batl = CONFIG_SYS_SDRAM_BASE | 0x42; -	mtspr (IBAT6L, batl); -	mtspr (IBAT6U, batu); -	mtspr (DBAT6L, batl); -	mtspr (DBAT6U, batu); - -	/* memory size is less than 256MB */ -	if (size <= 0x10000000) { -		/* Nothing */ -		batu = 0; -		batl = 0; -	} else { -		size -= 0x10000000; -		if (size <= 0x800000)	/* 8MB */ -			blocksize = BATU_BL_8M; -		else if (size <= 0x1000000)	/* 16MB */ -			blocksize = BATU_BL_16M; -		else if (size <= 0x2000000)	/* 32MB */ -			blocksize = BATU_BL_32M; -		else if (size <= 0x4000000)	/* 64MB */ -			blocksize = BATU_BL_64M; -		else if (size <= 0x8000000)	/* 128MB */ -			blocksize = BATU_BL_128M; -		else if (size <= 0x10000000)	/* 256MB */ -			blocksize = BATU_BL_256M; - -		batu = (CONFIG_SYS_SDRAM_BASE + -			0x10000000) | blocksize | BPP_RW | BPP_RX; -		batl = (CONFIG_SYS_SDRAM_BASE + 0x10000000) | 0x42; -	} - -	mtspr (IBAT7L, batl); -	mtspr (IBAT7U, batu); -	mtspr (DBAT7L, batl); -	mtspr (DBAT7U, batu); -} - -phys_size_t initdram (int board_type) -{ -	ulong size; - -	size = dramSetup (); - -/* if iCache ad dCache is defined */ -#if defined(CONFIG_CMD_CACHE) -/*    setupBat(size);*/ -#endif - -	return size; -} - -int checkboard (void) -{ -	puts ("Board: Alaska MPC8220 Evaluation Board\n"); - -	return 0; -} diff --git a/board/alaska/flash.c b/board/alaska/flash.c deleted file mode 100644 index 977822ac5..000000000 --- a/board/alaska/flash.c +++ /dev/null @@ -1,945 +0,0 @@ -/* - * (C) Copyright 2001 - * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net - * - * (C) Copyright 2001-2004 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> -#include <linux/byteorder/swab.h> - - -flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];	/* info for FLASH chips    */ - -/* Board support for 1 or 2 flash devices */ -#define FLASH_PORT_WIDTH8 - -typedef unsigned char FLASH_PORT_WIDTH; -typedef volatile unsigned char FLASH_PORT_WIDTHV; - -#define SWAP(x)         (x) - -/* Intel-compatible flash ID */ -#define INTEL_COMPAT    0x89 -#define INTEL_ALT       0xB0 - -/* Intel-compatible flash commands */ -#define INTEL_PROGRAM   0x10 -#define INTEL_ERASE     0x20 -#define INTEL_CLEAR     0x50 -#define INTEL_LOCKBIT   0x60 -#define INTEL_PROTECT   0x01 -#define INTEL_STATUS    0x70 -#define INTEL_READID    0x90 -#define INTEL_CONFIRM   0xD0 -#define INTEL_RESET     0xFF - -/* Intel-compatible flash status bits */ -#define INTEL_FINISHED  0x80 -#define INTEL_OK        0x80 - -#define FPW             FLASH_PORT_WIDTH -#define FPWV            FLASH_PORT_WIDTHV - -#define FLASH_CYCLE1    0x0555 -#define FLASH_CYCLE2    0x02aa - -#define WR_BLOCK        0x20 -/*----------------------------------------------------------------------- - * Functions - */ -static ulong flash_get_size (FPW * addr, flash_info_t * info); -static int write_data (flash_info_t * info, ulong dest, FPW data); -static int write_data_block (flash_info_t * info, ulong src, ulong dest); -static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data); -static void flash_get_offsets (ulong base, flash_info_t * info); -void inline spin_wheel (void); -static void flash_sync_real_protect (flash_info_t * info); -static unsigned char intel_sector_protected (flash_info_t *info, ushort sector); -static unsigned char same_chip_banks (int bank1, int bank2); - -/*----------------------------------------------------------------------- - */ - -unsigned long flash_init (void) -{ -	int i; -	ulong size = 0; -	ulong fsize = 0; - -	for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) { -		memset (&flash_info[i], 0, sizeof (flash_info_t)); - -		switch (i) { -		case 0: -			flash_get_size ((FPW *) CONFIG_SYS_FLASH1_BASE, -					&flash_info[i]); -			flash_get_offsets (CONFIG_SYS_FLASH1_BASE, &flash_info[i]); -			break; -		case 1: -			flash_get_size ((FPW *) CONFIG_SYS_FLASH1_BASE, -					&flash_info[i]); -			fsize = CONFIG_SYS_FLASH1_BASE + flash_info[i - 1].size; -			flash_get_offsets (fsize, &flash_info[i]); -			break; -		case 2: -			flash_get_size ((FPW *) CONFIG_SYS_FLASH0_BASE, -					&flash_info[i]); -			flash_get_offsets (CONFIG_SYS_FLASH0_BASE, &flash_info[i]); -			break; -		case 3: -			flash_get_size ((FPW *) CONFIG_SYS_FLASH0_BASE, -					&flash_info[i]); -			fsize = CONFIG_SYS_FLASH0_BASE + flash_info[i - 1].size; -			flash_get_offsets (fsize, &flash_info[i]); -			break; -		default: -			panic ("configured to many flash banks!\n"); -			break; -		} -		size += flash_info[i].size; - -		/* get the h/w and s/w protection status in sync */ -		flash_sync_real_protect(&flash_info[i]); -	} - -	/* Protect monitor and environment sectors -	 */ -#if defined (CONFIG_SYS_AMD_BOOT) -	flash_protect (FLAG_PROTECT_SET, -		       CONFIG_SYS_MONITOR_BASE, -		       CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1, -		       &flash_info[2]); -	flash_protect (FLAG_PROTECT_SET, -		       CONFIG_SYS_INTEL_BASE, -		       CONFIG_SYS_INTEL_BASE + monitor_flash_len - 1, -		       &flash_info[1]); -#else -	flash_protect (FLAG_PROTECT_SET, -		       CONFIG_SYS_MONITOR_BASE, -		       CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1, -		       &flash_info[3]); -	flash_protect (FLAG_PROTECT_SET, -		       CONFIG_SYS_AMD_BASE, -		       CONFIG_SYS_AMD_BASE + monitor_flash_len - 1, &flash_info[0]); -#endif - -	flash_protect (FLAG_PROTECT_SET, -		       CONFIG_ENV1_ADDR, -		       CONFIG_ENV1_ADDR + CONFIG_ENV1_SIZE - 1, &flash_info[1]); -	flash_protect (FLAG_PROTECT_SET, -		       CONFIG_ENV_ADDR, -		       CONFIG_ENV_ADDR + CONFIG_ENV_SIZE - 1, &flash_info[3]); - -	return size; -} - -/*----------------------------------------------------------------------- - */ -static void flash_get_offsets (ulong base, flash_info_t * info) -{ -	int i; - -	if (info->flash_id == FLASH_UNKNOWN) -		return; - -	if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD) { -		for (i = 0; i < info->sector_count; i++) { -			info->start[i] = base + (i * PHYS_AMD_SECT_SIZE); -			info->protect[i] = 0; -		} -	} - -	if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_INTEL) { -		for (i = 0; i < info->sector_count; i++) { -			info->start[i] = base + (i * PHYS_INTEL_SECT_SIZE); -		} -	} -} - -/*----------------------------------------------------------------------- - */ -void flash_print_info (flash_info_t * info) -{ -	int i; - -	if (info->flash_id == FLASH_UNKNOWN) { -		printf ("missing or unknown FLASH type\n"); -		return; -	} - -	switch (info->flash_id & FLASH_VENDMASK) { -	case FLASH_MAN_INTEL: -		printf ("INTEL "); -		break; -	case FLASH_MAN_AMD: -		printf ("AMD "); -		break; -	default: -		printf ("Unknown Vendor "); -		break; -	} - -	switch (info->flash_id & FLASH_TYPEMASK) { -	case FLASH_28F128J3A: -		printf ("28F128J3A\n"); -		break; - -	case FLASH_AM040: -		printf ("AMD29F040B\n"); -		break; - -	default: -		printf ("Unknown Chip Type\n"); -		break; -	} - -	printf ("  Size: %ld MB in %d Sectors\n", -		info->size >> 20, info->sector_count); - -	printf ("  Sector Start Addresses:"); -	for (i = 0; i < info->sector_count; ++i) { -		if ((i % 5) == 0) -			printf ("\n   "); -		printf (" %08lX%s", -			info->start[i], info->protect[i] ? " (RO)" : "     "); -	} -	printf ("\n"); -	return; -} - -/* - * The following code cannot be run from FLASH! - */ -static ulong flash_get_size (FPW * addr, flash_info_t * info) -{ -	FPWV value; -	static int amd = 0; - -	/* Write auto select command: read Manufacturer ID */ -	/* Write auto select command sequence and test FLASH answer */ -	addr[FLASH_CYCLE1] = (FPW) 0x00AA00AA;	/* for AMD, Intel ignores this */ -	__asm__ ("sync"); -	addr[FLASH_CYCLE2] = (FPW) 0x00550055;	/* for AMD, Intel ignores this */ -	__asm__ ("sync"); -	addr[FLASH_CYCLE1] = (FPW) 0x00900090;	/* selects Intel or AMD */ -	__asm__ ("sync"); - -	udelay (100); - -	switch (addr[0] & 0xff) { - -	case (uchar) AMD_MANUFACT: -		info->flash_id = FLASH_MAN_AMD; -		value = addr[1]; -		break; - -	case (uchar) INTEL_MANUFACT: -		info->flash_id = FLASH_MAN_INTEL; -		value = addr[2]; -		break; - -	default: -		printf ("unknown\n"); -		info->flash_id = FLASH_UNKNOWN; -		info->sector_count = 0; -		info->size = 0; -		addr[0] = (FPW) 0x00FF00FF;	/* restore read mode */ -		return (0);	/* no or unknown flash  */ -	} - -	switch (value) { - -	case (FPW) INTEL_ID_28F128J3A: -		info->flash_id += FLASH_28F128J3A; -		info->sector_count = 64; -		info->size = 0x00800000;	/* => 16 MB     */ -		break; - -	case (FPW) AMD_ID_LV040B: -		info->flash_id += FLASH_AM040; -		if (amd == 0) { -			info->sector_count = 7; -			info->size = 0x00070000;	/* => 448 KB     */ -			amd = 1; -		} else { -			/* for Environment settings */ -			info->sector_count = 1; -			info->size = PHYS_AMD_SECT_SIZE;	/* => 64 KB     */ -			amd = 0; -		} -		break; - -	default: -		info->flash_id = FLASH_UNKNOWN; -		break; -	} - -	if (info->sector_count > CONFIG_SYS_MAX_FLASH_SECT) { -		printf ("** ERROR: sector count %d > max (%d) **\n", -			info->sector_count, CONFIG_SYS_MAX_FLASH_SECT); -		info->sector_count = CONFIG_SYS_MAX_FLASH_SECT; -	} - -	if (value == (FPW) INTEL_ID_28F128J3A) -		addr[0] = (FPW) 0x00FF00FF;	/* restore read mode */ -	else -		addr[0] = (FPW) 0x00F000F0;	/* restore read mode */ - -	return (info->size); -} - - -/* - * This function gets the u-boot flash sector protection status - * (flash_info_t.protect[]) in sync with the sector protection - * status stored in hardware. - */ -static void flash_sync_real_protect (flash_info_t * info) -{ -	int i; - -	switch (info->flash_id & FLASH_TYPEMASK) { -	case FLASH_28F128J3A: -		for (i = 0; i < info->sector_count; ++i) { -			info->protect[i] = intel_sector_protected(info, i); -		} -		break; -	case FLASH_AM040: -	default: -		/* no h/w protect support */ -		break; -	} -} - - -/* - * checks if "sector" in bank "info" is protected. Should work on intel - * strata flash chips 28FxxxJ3x in 8-bit mode. - * Returns 1 if sector is protected (or timed-out while trying to read - * protection status), 0 if it is not. - */ -static unsigned char intel_sector_protected (flash_info_t *info, ushort sector) -{ -	FPWV *addr; -	FPWV *lock_conf_addr; -	ulong start; -	unsigned char ret; - -	/* -	 * first, wait for the WSM to be finished. The rationale for -	 * waiting for the WSM to become idle for at most -	 * CONFIG_SYS_FLASH_ERASE_TOUT is as follows. The WSM can be busy -	 * because of: (1) erase, (2) program or (3) lock bit -	 * configuration. So we just wait for the longest timeout of -	 * the (1)-(3), i.e. the erase timeout. -	 */ - -	/* wait at least 35ns (W12) before issuing Read Status Register */ -	udelay(1); -	addr = (FPWV *) info->start[sector]; -	*addr = (FPW) INTEL_STATUS; - -	start = get_timer (0); -	while ((*addr & (FPW) INTEL_FINISHED) != (FPW) INTEL_FINISHED) { -		if (get_timer (start) > CONFIG_SYS_FLASH_ERASE_TOUT) { -			*addr = (FPW) INTEL_RESET; /* restore read mode */ -			printf("WSM busy too long, can't get prot status\n"); -			return 1; -		} -	} - -	/* issue the Read Identifier Codes command */ -	*addr = (FPW) INTEL_READID; - -	/* wait at least 35ns (W12) before reading */ -	udelay(1); - -	/* Intel example code uses offset of 4 for 8-bit flash */ -	lock_conf_addr = (FPWV *) info->start[sector] + 4; -	ret = (*lock_conf_addr & (FPW) INTEL_PROTECT) ? 1 : 0; - -	/* put flash back in read mode */ -	*addr = (FPW) INTEL_RESET; - -	return ret; -} - - -/* - * Checks if "bank1" and "bank2" are on the same chip.  Returns 1 if they - * are and 0 otherwise. - */ -static unsigned char same_chip_banks (int bank1, int bank2) -{ -	unsigned char same_chip[CONFIG_SYS_MAX_FLASH_BANKS][CONFIG_SYS_MAX_FLASH_BANKS] = { -		{1, 1, 0, 0}, -		{1, 1, 0, 0}, -		{0, 0, 1, 1}, -		{0, 0, 1, 1} -	}; -	return same_chip[bank1][bank2]; -} - - -/*----------------------------------------------------------------------- - */ -int flash_erase (flash_info_t * info, int s_first, int s_last) -{ -	int flag, prot, sect; -	ulong type, start; -	int rcode = 0, intel = 0; - -	if ((s_first < 0) || (s_first > s_last)) { -		if (info->flash_id == FLASH_UNKNOWN) -			printf ("- missing\n"); -		else -			printf ("- no sectors to erase\n"); -		return 1; -	} - -	type = (info->flash_id & FLASH_VENDMASK); -	if ((type != FLASH_MAN_INTEL)) { -		type = (info->flash_id & FLASH_VENDMASK); -		if ((type != FLASH_MAN_AMD)) { -			printf ("Can't erase unknown flash type %08lx - aborted\n", -				info->flash_id); -			return 1; -		} -	} - -	if (type == FLASH_MAN_INTEL) -		intel = 1; - -	prot = 0; -	for (sect = s_first; sect <= s_last; ++sect) { -		if (info->protect[sect]) { -			prot++; -		} -	} - -	if (prot) { -		printf ("- Warning: %d protected sectors will not be erased!\n", prot); -	} else { -		printf ("\n"); -	} - -	start = get_timer (0); - -	/* Disable interrupts which might cause a timeout here */ -	flag = disable_interrupts (); - -	/* Start erase on unprotected sectors */ -	for (sect = s_first; sect <= s_last; sect++) { -		if (info->protect[sect] == 0) {	/* not protected */ -			FPWV *addr = (FPWV *) (info->start[sect]); -			FPW status; - -			printf ("Erasing sector %2d ... ", sect); - -			/* arm simple, non interrupt dependent timer */ -			start = get_timer (0); - -			if (intel) { -				*addr = (FPW) 0x00500050;	/* clear status register */ -				*addr = (FPW) 0x00200020;	/* erase setup */ -				*addr = (FPW) 0x00D000D0;	/* erase confirm */ -			} else { -				FPWV *base;	/* first address in bank */ - -				base = (FPWV *) (CONFIG_SYS_AMD_BASE); -				base[FLASH_CYCLE1] = (FPW) 0x00AA00AA;	/* unlock */ -				base[FLASH_CYCLE2] = (FPW) 0x00550055;	/* unlock */ -				base[FLASH_CYCLE1] = (FPW) 0x00800080;	/* erase mode */ -				base[FLASH_CYCLE1] = (FPW) 0x00AA00AA;	/* unlock */ -				base[FLASH_CYCLE2] = (FPW) 0x00550055;	/* unlock */ -				*addr = (FPW) 0x00300030;	/* erase sector */ -			} - -			while (((status = -				 *addr) & (FPW) 0x00800080) != -			       (FPW) 0x00800080) { -				if (get_timer (start) > CONFIG_SYS_FLASH_ERASE_TOUT) { -					printf ("Timeout\n"); -					if (intel) { -						*addr = (FPW) 0x00B000B0;	/* suspend erase     */ -						*addr = (FPW) 0x00FF00FF;	/* reset to read mode */ -					} else -						*addr = (FPW) 0x00F000F0;	/* reset to read mode */ - -					rcode = 1; -					break; -				} -			} - -			if (intel) { -				*addr = (FPW) 0x00500050;	/* clear status register cmd.   */ -				*addr = (FPW) 0x00FF00FF;	/* resest to read mode          */ -			} else -				*addr = (FPW) 0x00F000F0;	/* reset to read mode */ - -			printf (" done\n"); -		} -	} -	if (flag) -		enable_interrupts(); - -	return rcode; -} - -/*----------------------------------------------------------------------- - * Copy memory to flash, returns: - * 0 - OK - * 1 - write timeout - * 2 - Flash not erased - * 4 - Flash not identified - */ - -int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt) -{ -	if (info->flash_id == FLASH_UNKNOWN) { -		return 4; -	} - -	switch (info->flash_id & FLASH_VENDMASK) { -	case FLASH_MAN_AMD: -	    { -		FPW data = 0;	/* 16 or 32 bit word, matches flash bus width */ -		int bytes;	/* number of bytes to program in current word */ -		int left;	/* number of bytes left to program */ -		int i, res; - -		for (left = cnt, res = 0; -		     left > 0 && res == 0; -		     addr += sizeof (data), left -= -		     sizeof (data) - bytes) { - -			bytes = addr & (sizeof (data) - 1); -			addr &= ~(sizeof (data) - 1); - -			/* combine source and destination data so can program -			 * an entire word of 16 or 32 bits -			 */ -			for (i = 0; i < sizeof (data); i++) { -				data <<= 8; -				if (i < bytes || i - bytes >= left) -					data += *((uchar *) addr + i); -				else -					data += *src++; -			} - -			res = write_word_amd (info, (FPWV *) addr, -					      data); -		} -		return res; -	    }		/* case FLASH_MAN_AMD */ - -	case FLASH_MAN_INTEL: -	    { -		ulong cp, wp; -		FPW data; -		int count, i, l, rc, port_width; - -		/* get lower word aligned address */ -		wp = addr; -		port_width = 1; - -		/* -		 * handle unaligned start bytes -		 */ -		if ((l = addr - wp) != 0) { -			data = 0; -			for (i = 0, cp = wp; i < l; ++i, ++cp) { -				data = (data << 8) | (*(uchar *) cp); -			} - -			for (; i < port_width && cnt > 0; ++i) { -				data = (data << 8) | *src++; -				--cnt; -				++cp; -			} - -			for (; cnt == 0 && i < port_width; ++i, ++cp) -				data = (data << 8) | (*(uchar *) cp); - -			if ((rc = -			     write_data (info, wp, SWAP (data))) != 0) -				return (rc); -			wp += port_width; -		} - -		if (cnt > WR_BLOCK) { -			/* -			 * handle word aligned part -			 */ -			count = 0; -			while (cnt >= WR_BLOCK) { - -				if ((rc = -				     write_data_block (info, -						       (ulong) src, -						       wp)) != 0) -					return (rc); - -				wp += WR_BLOCK; -				src += WR_BLOCK; -				cnt -= WR_BLOCK; - -				if (count++ > 0x800) { -					spin_wheel (); -					count = 0; -				} -			} -		} - -		if (cnt < WR_BLOCK) { -			/* -			 * handle word aligned part -			 */ -			count = 0; -			while (cnt >= port_width) { -				data = 0; -				for (i = 0; i < port_width; ++i) -					data = (data << 8) | *src++; - -				if ((rc = -				     write_data (info, wp, -						 SWAP (data))) != 0) -					return (rc); - -				wp += port_width; -				cnt -= port_width; -				if (count++ > 0x800) { -					spin_wheel (); -					count = 0; -				} -			} -		} - -		if (cnt == 0) -			return (0); - -		/* -		 * handle unaligned tail bytes -		 */ -		data = 0; -		for (i = 0, cp = wp; i < port_width && cnt > 0; -		     ++i, ++cp) { -			data = (data << 8) | *src++; -			--cnt; -		} - -		for (; i < port_width; ++i, ++cp) -			data = (data << 8) | (*(uchar *) cp); - -		return (write_data (info, wp, SWAP (data))); -	    }		/* case FLASH_MAN_INTEL */ - -	}			/* switch */ -	return (0); -} - -/*----------------------------------------------------------------------- - * Write a word or halfword to Flash, returns: - * 0 - OK - * 1 - write timeout - * 2 - Flash not erased - */ -static int write_data (flash_info_t * info, ulong dest, FPW data) -{ -	FPWV *addr = (FPWV *) dest; -	ulong start; -	int flag, rc = 0; - -	/* Check if Flash is (sufficiently) erased */ -	if ((*addr & data) != data) { -		printf ("not erased at %08lx (%lx)\n", (ulong)addr, (ulong)*addr); -		return (2); -	} -	/* Disable interrupts which might cause a timeout here */ -	flag = disable_interrupts (); - -	*addr = (FPW) 0x00400040;	/* write setup */ -	*addr = data; - -	/* arm simple, non interrupt dependent timer */ -	start = get_timer (0); - -	/* wait while polling the status register */ -	while ((*addr & (FPW) 0x00800080) != (FPW) 0x00800080) { -		if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) { -			rc = 1; -			goto OUT; -		} -	} - -OUT: -	*addr = (FPW)0x00FF00FF;	/* restore read mode */ - -	if (flag) -		enable_interrupts(); - -	return rc; -} - -/*----------------------------------------------------------------------- - * Write a word or halfword to Flash, returns: - * 0 - OK - * 1 - write timeout - * 2 - Flash not erased - */ -static int write_data_block (flash_info_t * info, ulong src, ulong dest) -{ -	FPWV *srcaddr = (FPWV *) src; -	FPWV *dstaddr = (FPWV *) dest; -	ulong start; -	int flag, i, rc = 0; - -	/* Check if Flash is (sufficiently) erased */ -	for (i = 0; i < WR_BLOCK; i++) -		if ((*dstaddr++ & 0xff) != 0xff) { -			printf ("not erased at %08lx (%lx)\n", -				(ulong)dstaddr, (ulong)*dstaddr); -			return (2); -		} - -	dstaddr = (FPWV *) dest; - -	/* Disable interrupts which might cause a timeout here */ -	flag = disable_interrupts (); - -	*dstaddr = (FPW) 0x00e800e8;	/* write block setup */ - -	/* arm simple, non interrupt dependent timer */ -	start = get_timer (0); - -	/* wait while polling the status register */ -	while ((*dstaddr & (FPW)0x00800080) != (FPW)0x00800080) { -		if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) { -			rc = 1; -			goto OUT; -		} -	} - -	*dstaddr = (FPW) 0x001f001f;	/* write 32 to buffer */ -	for (i = 0; i < WR_BLOCK; i++) -		*dstaddr++ = *srcaddr++; - -	dstaddr -= 1; -	*dstaddr = (FPW) 0x00d000d0;	/* write 32 to buffer */ - -	/* arm simple, non interrupt dependent timer */ -	start = get_timer (0); - -	/* wait while polling the status register */ -	while ((*dstaddr & (FPW) 0x00800080) != (FPW) 0x00800080) { -		if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) { -			*dstaddr = (FPW) 0x00FF00FF;	/* restore read mode */ -			return (1); -		} -	} - -OUT: -	*dstaddr = (FPW)0x00FF00FF;	/* restore read mode */ -	if (flag) -		enable_interrupts(); - -	return rc; -} - -/*----------------------------------------------------------------------- - * Write a word to Flash for AMD FLASH - * A word is 16 or 32 bits, whichever the bus width of the flash bank - * (not an individual chip) is. - * - * returns: - * 0 - OK - * 1 - write timeout - * 2 - Flash not erased - */ -static int write_word_amd (flash_info_t * info, FPWV * dest, FPW data) -{ -	ulong start; -	int flag; -	int res = 0;		/* result, assume success */ -	FPWV *base;		/* first address in flash bank */ - -	/* Check if Flash is (sufficiently) erased */ -	if ((*dest & data) != data) { -		return (2); -	} - -	base = (FPWV *) (CONFIG_SYS_AMD_BASE); - -	/* Disable interrupts which might cause a timeout here */ -	flag = disable_interrupts (); - -	base[FLASH_CYCLE1] = (FPW) 0x00AA00AA;	/* unlock */ -	base[FLASH_CYCLE2] = (FPW) 0x00550055;	/* unlock */ -	base[FLASH_CYCLE1] = (FPW) 0x00A000A0;	/* selects program mode */ - -	*dest = data;		/* start programming the data */ - -	/* re-enable interrupts if necessary */ -	if (flag) -		enable_interrupts (); - -	start = get_timer (0); - -	/* data polling for D7 */ -	while (res == 0 -	       && (*dest & (FPW) 0x00800080) != (data & (FPW) 0x00800080)) { -		if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) { -			*dest = (FPW) 0x00F000F0;	/* reset bank */ -			res = 1; -		} -	} - -	return (res); -} - -void inline spin_wheel (void) -{ -	static int p = 0; -	static char w[] = "\\/-"; - -	printf ("\010%c", w[p]); -	(++p == 3) ? (p = 0) : 0; -} - -/*----------------------------------------------------------------------- - * Set/Clear sector's lock bit, returns: - * 0 - OK - * 1 - Error (timeout, voltage problems, etc.) - */ -int flash_real_protect (flash_info_t * info, long sector, int prot) -{ -	ulong start; -	int i, j; -	int curr_bank; -	int bank; -	int rc = 0; -	FPWV *addr = (FPWV *) (info->start[sector]); -	int flag = disable_interrupts (); - -	/* -	 * 29F040B AMD flash does not support software protection/unprotection, -	 * the only way to protect the AMD flash is marked it as prot bit. -	 * This flash only support hardware protection, by supply or not supply -	 * 12vpp to the flash -	 */ -	if ((info->flash_id & FLASH_VENDMASK) == FLASH_MAN_AMD) { -		info->protect[sector] = prot; - -		return 0; -	} - -	*addr = INTEL_CLEAR;	/* Clear status register    */ -	if (prot) {		/* Set sector lock bit      */ -		*addr = INTEL_LOCKBIT;	/* Sector lock bit          */ -		*addr = INTEL_PROTECT;	/* set                      */ -	} else {		/* Clear sector lock bit    */ -		*addr = INTEL_LOCKBIT;	/* All sectors lock bits    */ -		*addr = INTEL_CONFIRM;	/* clear                    */ -	} - -	start = get_timer (0); - -	while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) { -		if (get_timer (start) > CONFIG_SYS_FLASH_UNLOCK_TOUT) { -			printf ("Flash lock bit operation timed out\n"); -			rc = 1; -			break; -		} -	} - -	if (*addr != INTEL_OK) { -		printf ("Flash lock bit operation failed at %08X, CSR=%08X\n", -			(uint) addr, (uint) * addr); -		rc = 1; -	} - -	if (!rc) -		info->protect[sector] = prot; - -	/* -	 * Clear lock bit command clears all sectors lock bits, so -	 * we have to restore lock bits of protected sectors. -	 */ -	if (!prot) { -		/* -		 * re-locking must be done for all banks that belong on one -		 * FLASH chip, as all the sectors on the chip were unlocked -		 * by INTEL_LOCKBIT/INTEL_CONFIRM commands. (let's hope -		 * that banks never span chips, in particular chips which -		 * support h/w protection differently). -		 */ - -		/* find the current bank number */ -		curr_bank = CONFIG_SYS_MAX_FLASH_BANKS + 1; -		for (j = 0; j < CONFIG_SYS_MAX_FLASH_BANKS; ++j) { -			if (&flash_info[j] == info) { -				curr_bank = j; -			} -		} -		if (curr_bank == CONFIG_SYS_MAX_FLASH_BANKS + 1) { -			printf("Error: can't determine bank number!\n"); -		} - -		for (bank = 0; bank < CONFIG_SYS_MAX_FLASH_BANKS; ++bank) { -			if (!same_chip_banks(curr_bank, bank)) { -				continue; -			} -			info = &flash_info[bank]; -			for (i = 0; i < info->sector_count; i++) { -				if (info->protect[i]) { -					start = get_timer (0); -					addr = (FPWV *) (info->start[i]); -					*addr = INTEL_LOCKBIT;	/* Sector lock bit  */ -					*addr = INTEL_PROTECT;	/* set              */ -					while ((*addr & INTEL_FINISHED) != -					       INTEL_FINISHED) { -						if (get_timer (start) > -						    CONFIG_SYS_FLASH_UNLOCK_TOUT) { -							printf ("Flash lock bit operation timed out\n"); -							rc = 1; -							break; -						} -					} -				} -			} -		} - -		/* -		 * get the s/w sector protection status in sync with the h/w, -		 * in case something went wrong during the re-locking. -		 */ -		flash_sync_real_protect(info); /* resets flash to read  mode */ -	} - -	if (flag) -		enable_interrupts (); - -	*addr = INTEL_RESET;	/* Reset to read array mode */ - -	return rc; -} diff --git a/board/armltd/vexpress/Makefile b/board/armltd/vexpress/Makefile index 87495901f..6719f3d44 100644 --- a/board/armltd/vexpress/Makefile +++ b/board/armltd/vexpress/Makefile @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).o -COBJS	:= ca9x4_ct_vxp.o +COBJS	:= vexpress_common.o  SRCS	:= $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) diff --git a/board/armltd/vexpress/ca9x4_ct_vxp.c b/board/armltd/vexpress/vexpress_common.c index d5e109ec0..2c54869e2 100644 --- a/board/armltd/vexpress/ca9x4_ct_vxp.c +++ b/board/armltd/vexpress/vexpress_common.c @@ -45,8 +45,7 @@  static ulong timestamp;  static ulong lastdec; -static struct wdt *wdt_base = (struct wdt *)WDT_BASE; -static struct systimer *systimer_base = (struct systimer *)SYSTIMER_BASE; +static struct systimer *systimer_base = (struct systimer *)V2M_TIMER01;  static struct sysctrl *sysctrl_base = (struct sysctrl *)SCTL_BASE;  static void flash__init(void); @@ -166,20 +165,38 @@ static void vexpress_timer_init(void)  	 */  	writel(SYSTIMER_RELOAD, &systimer_base->timer0load);  	writel(SYSTIMER_RELOAD, &systimer_base->timer0value); -	writel(SYSTIMER_EN | SYSTIMER_32BIT | \ -	       readl(&systimer_base->timer0control), \ +	writel(SYSTIMER_EN | SYSTIMER_32BIT | +	       readl(&systimer_base->timer0control),  	       &systimer_base->timer0control);  	reset_timer_masked();  } +int v2m_cfg_write(u32 devfn, u32 data) +{ +	/* Configuration interface broken? */ +	u32 val; + +	devfn |= SYS_CFG_START | SYS_CFG_WRITE; + +	val = readl(V2M_SYS_CFGSTAT); +	writel(val & ~SYS_CFG_COMPLETE, V2M_SYS_CFGSTAT); + +	writel(data, V2M_SYS_CFGDATA); +	writel(devfn, V2M_SYS_CFGCTRL); + +	do { +		val = readl(V2M_SYS_CFGSTAT); +	} while (val == 0); + +	return !!(val & SYS_CFG_ERR); +} +  /* Use the ARM Watchdog System to cause reset */  void reset_cpu(ulong addr)  { -	writeb(WDT_EN, &wdt_base->wdogcontrol); -	writel(WDT_RESET_LOAD, &wdt_base->wdogload); -	while (1) -		; +	if (v2m_cfg_write(SYS_CFG_REBOOT | SYS_CFG_SITE_MB, 0)) +		printf("Unable to reboot\n");  }  /* @@ -251,7 +268,7 @@ unsigned long long get_ticks(void)  	return get_timer(0);  } -ulong get_tbclk (void) +ulong get_tbclk(void)  {  	return (ulong)CONFIG_SYS_HZ;  } diff --git a/board/ti/omap2420h4/Makefile b/board/atmel/sama5d3xek/Makefile index cddd7e698..45d24d23d 100644 --- a/board/ti/omap2420h4/Makefile +++ b/board/atmel/sama5d3xek/Makefile @@ -1,7 +1,14 @@  # -# (C) Copyright 2000-2006 +# (C) Copyright 2003-2008  # Wolfgang Denk, DENX Software Engineering, wd@denx.de.  # +# (C) Copyright 2008 +# Stelian Pop <stelian@popies.net> +# Lead Tech Design <www.leadtechdesign.com> +# +# (C) Copyright 2013 +# Bo Shen <voice.shen@atmel.com> +#  # See file CREDITS for list of people who contributed to this  # project.  # @@ -12,7 +19,7 @@  #  # This program is distributed in the hope that it will be useful,  # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  # GNU General Public License for more details.  #  # You should have received a copy of the GNU General Public License @@ -25,11 +32,10 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).o -COBJS	:= omap2420h4.o mem.o sys_info.o -SOBJS	:= lowlevel_init.o +COBJS-y += sama5d3xek.o -SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS	:= $(addprefix $(obj),$(COBJS)) +SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS	:= $(addprefix $(obj),$(COBJS-y))  SOBJS	:= $(addprefix $(obj),$(SOBJS))  $(LIB):	$(obj).depend $(OBJS) $(SOBJS) diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c new file mode 100644 index 000000000..541296dbd --- /dev/null +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -0,0 +1,275 @@ +/* + * Copyright (C) 2012 - 2013 Atmel Corporation + * Bo Shen <voice.shen@atmel.com> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <mmc.h> +#include <asm/io.h> +#include <asm/arch/sama5d3_smc.h> +#include <asm/arch/at91_common.h> +#include <asm/arch/at91_pmc.h> +#include <asm/arch/at91_rstc.h> +#include <asm/arch/gpio.h> +#include <asm/arch/clk.h> +#include <lcd.h> +#include <atmel_lcdc.h> +#include <atmel_mci.h> +#include <net.h> +#include <netdev.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* ------------------------------------------------------------------------- */ +/* + * Miscelaneous platform dependent initialisations + */ + +#ifdef CONFIG_NAND_ATMEL +void sama5d3xek_nand_hw_init(void) +{ +	struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC; + +	at91_periph_clk_enable(ATMEL_ID_SMC); + +	/* Configure SMC CS3 for NAND/SmartMedia */ +	writel(AT91_SMC_SETUP_NWE(2) | AT91_SMC_SETUP_NCS_WR(1) | +	       AT91_SMC_SETUP_NRD(2) | AT91_SMC_SETUP_NCS_RD(1), +	       &smc->cs[3].setup); +	writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(5) | +	       AT91_SMC_PULSE_NRD(3) | AT91_SMC_PULSE_NCS_RD(5), +	       &smc->cs[3].pulse); +	writel(AT91_SMC_CYCLE_NWE(8) | AT91_SMC_CYCLE_NRD(8), +	       &smc->cs[3].cycle); +	writel(AT91_SMC_TIMINGS_TCLR(3) | AT91_SMC_TIMINGS_TADL(10) | +	       AT91_SMC_TIMINGS_TAR(3)  | AT91_SMC_TIMINGS_TRR(4)   | +	       AT91_SMC_TIMINGS_TWB(5)  | AT91_SMC_TIMINGS_RBNSEL(3)| +	       AT91_SMC_TIMINGS_NFSEL(1), &smc->cs[3].timings); +	writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE | +	       AT91_SMC_MODE_EXNW_DISABLE | +#ifdef CONFIG_SYS_NAND_DBW_16 +	       AT91_SMC_MODE_DBW_16 | +#else /* CONFIG_SYS_NAND_DBW_8 */ +	       AT91_SMC_MODE_DBW_8 | +#endif +	       AT91_SMC_MODE_TDF_CYCLE(3), +	       &smc->cs[3].mode); +} +#endif + +#ifdef CONFIG_CMD_USB +static void sama5d3xek_usb_hw_init(void) +{ +	at91_set_pio_output(AT91_PIO_PORTD, 25, 0); +	at91_set_pio_output(AT91_PIO_PORTD, 26, 0); +	at91_set_pio_output(AT91_PIO_PORTD, 27, 0); +} +#endif + +#ifdef CONFIG_GENERIC_ATMEL_MCI +static void sama5d3xek_mci_hw_init(void) +{ +	at91_mci_hw_init(); + +	at91_set_pio_output(AT91_PIO_PORTB, 10, 0);	/* MCI0 Power */ +} +#endif + +#ifdef CONFIG_LCD +vidinfo_t panel_info = { +	.vl_col = 800, +	.vl_row = 480, +	.vl_clk = 24000000, +	.vl_sync = ATMEL_LCDC_INVLINE_NORMAL | ATMEL_LCDC_INVFRAME_NORMAL, +	.vl_bpix = LCD_BPP, +	.vl_tft = 1, +	.vl_hsync_len = 128, +	.vl_left_margin = 64, +	.vl_right_margin = 64, +	.vl_vsync_len = 2, +	.vl_upper_margin = 22, +	.vl_lower_margin = 21, +	.mmio = ATMEL_BASE_LCDC, +}; + +void lcd_enable(void) +{ +} + +void lcd_disable(void) +{ +} + +static void sama5d3xek_lcd_hw_init(void) +{ +	gd->fb_base = CONFIG_SAMA5D3_LCD_BASE; + +	/* The higher 8 bit of LCD is board related */ +	at91_set_c_periph(AT91_PIO_PORTC, 14, 0);	/* LCDD16 */ +	at91_set_c_periph(AT91_PIO_PORTC, 13, 0);	/* LCDD17 */ +	at91_set_c_periph(AT91_PIO_PORTC, 12, 0);	/* LCDD18 */ +	at91_set_c_periph(AT91_PIO_PORTC, 11, 0);	/* LCDD19 */ +	at91_set_c_periph(AT91_PIO_PORTC, 10, 0);	/* LCDD20 */ +	at91_set_c_periph(AT91_PIO_PORTC, 15, 0);	/* LCDD21 */ +	at91_set_c_periph(AT91_PIO_PORTE, 27, 0);	/* LCDD22 */ +	at91_set_c_periph(AT91_PIO_PORTE, 28, 0);	/* LCDD23 */ + +	/* Configure lower 16 bit of LCD and enable clock */ +	at91_lcd_hw_init(); +} + +#ifdef CONFIG_LCD_INFO +#include <nand.h> +#include <version.h> + +void lcd_show_board_info(void) +{ +	ulong dram_size, nand_size; +	int i; +	char temp[32]; + +	lcd_printf("%s\n", U_BOOT_VERSION); +	lcd_printf("(C) 2013 ATMEL Corp\n"); +	lcd_printf("at91@atmel.com\n"); +	lcd_printf("%s CPU at %s MHz\n", get_cpu_name(), +		   strmhz(temp, get_cpu_clk_rate())); + +	dram_size = 0; +	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) +		dram_size += gd->bd->bi_dram[i].size; + +	nand_size = 0; +#ifdef CONFIG_NAND_ATMEL +	for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) +		nand_size += nand_info[i].size; +#endif +	lcd_printf("%ld MB SDRAM, %ld MB NAND\n", +		   dram_size >> 20, nand_size >> 20); +} +#endif /* CONFIG_LCD_INFO */ +#endif /* CONFIG_LCD */ + +int board_early_init_f(void) +{ +	at91_seriald_hw_init(); + +	return 0; +} + +int board_init(void) +{ +	/* adress of boot parameters */ +	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + +#ifdef CONFIG_NAND_ATMEL +	sama5d3xek_nand_hw_init(); +#endif +#ifdef CONFIG_CMD_USB +	sama5d3xek_usb_hw_init(); +#endif +#ifdef CONFIG_GENERIC_ATMEL_MCI +	sama5d3xek_mci_hw_init(); +#endif +#ifdef CONFIG_ATMEL_SPI +	at91_spi0_hw_init(1 << 0); +#endif +#ifdef CONFIG_MACB +	if (has_emac()) +		at91_macb_hw_init(); +#endif +#ifdef CONFIG_LCD +	if (has_lcdc()) +		sama5d3xek_lcd_hw_init(); +#endif +	return 0; +} + +int dram_init(void) +{ +	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, +				    CONFIG_SYS_SDRAM_SIZE); +	return 0; +} + +int board_eth_init(bd_t *bis) +{ +	int rc = 0; + +#ifdef CONFIG_MACB +	if (has_emac()) +		rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC, 0x00); +#endif + +	return rc; +} + +#ifdef CONFIG_GENERIC_ATMEL_MCI +int board_mmc_init(bd_t *bis) +{ +	int rc = 0; + +	rc = atmel_mci_init((void *)ATMEL_BASE_MCI0); + +	return rc; +} +#endif + +/* SPI chip select control */ +#ifdef CONFIG_ATMEL_SPI +#include <spi.h> + +int spi_cs_is_valid(unsigned int bus, unsigned int cs) +{ +	return bus == 0 && cs < 4; +} + +void spi_cs_activate(struct spi_slave *slave) +{ +	switch (slave->cs) { +	case 0: +		at91_set_pio_output(AT91_PIO_PORTD, 13, 0); +	case 1: +		at91_set_pio_output(AT91_PIO_PORTD, 14, 0); +	case 2: +		at91_set_pio_output(AT91_PIO_PORTD, 15, 0); +	case 3: +		at91_set_pio_output(AT91_PIO_PORTD, 16, 0); +	default: +		break; +	} +} + +void spi_cs_deactivate(struct spi_slave *slave) +{ +	switch (slave->cs) { +	case 0: +		at91_set_pio_output(AT91_PIO_PORTD, 13, 1); +	case 1: +		at91_set_pio_output(AT91_PIO_PORTD, 14, 1); +	case 2: +		at91_set_pio_output(AT91_PIO_PORTD, 15, 1); +	case 3: +		at91_set_pio_output(AT91_PIO_PORTD, 16, 1); +	default: +		break; +	} +} +#endif /* CONFIG_ATMEL_SPI */ diff --git a/board/bf609-ezkit/soft_switch.c b/board/bf609-ezkit/soft_switch.c new file mode 100644 index 000000000..e0c8d93fe --- /dev/null +++ b/board/bf609-ezkit/soft_switch.c @@ -0,0 +1,171 @@ +/* + * U-boot - main board file + * + * Copyright (c) 2008-2011 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#include <common.h> +#include <asm/blackfin.h> +#include <asm/io.h> +#include <i2c.h> +#include "soft_switch.h" + +struct switch_config { +	uchar dir0; /* IODIRA */ +	uchar dir1; /* IODIRB */ +	uchar value0; /* OLATA */ +	uchar value1; /* OLATB */ +}; + +static struct switch_config switch_config_array[NUM_SWITCH] = { +	{ +/* +	U45 Port A                     U45 Port B + +	7---------------  RMII_CLK_EN  |  7--------------- ~TEMP_THERM_EN +	| 6------------- ~CNT0ZM_EN    |  | 6------------- ~TEMP_IRQ_EN +	| | 5----------- ~CNT0DG_EN    |  | | 5----------- ~UART0CTS_146_EN +	| | | 4--------- ~CNT0UD_EN    |  | | | 4--------- ~UART0CTS_RST_EN +	| | | | 3------- ~CAN0RX_EN    |  | | | | 3------- ~UART0CTS_RTS_LPBK +	| | | | | 2----- ~CAN0_ERR_EN  |  | | | | | 2----- ~UART0CTS_EN +	| | | | | | 1--- ~CAN_STB      |  | | | | | | 1--- ~UART0RX_EN +	| | | | | | | 0-  CAN_EN       |  | | | | | | | 0- ~UART0RTS_EN +	| | | | | | | |                |  | | | | | | | | +	O O O O O O O O                |  O O O O O O O O   (I/O direction) +	1 0 0 0 0 0 1 1                |  1 1 1 1 1 0 0 0   (value being set) +*/ +		.dir0 = 0x0, /* all output */ +		.dir1 = 0x0, /* all output */ +		.value0 = RMII_CLK_EN | CAN_STB | CAN_EN, +		.value1 = TEMP_THERM_EN | TEMP_IRQ_EN | UART0CTS_146_EN +				| UART0CTS_RST_EN | UART0CTS_RTS_LPBK, +	}, +	{ +/* +	U46 Port A                       U46 Port B + +	7--------------- ~LED4_GPIO_EN   |  7---------------  EMPTY +	| 6------------- ~LED3_GPIO_EN   |  | 6------------- ~SPI0D3_EN +	| | 5----------- ~LED2_GPIO_EN   |  | | 5----------- ~SPI0D2_EN +	| | | 4--------- ~LED1_GPIO_EN   |  | | | 4--------- ~SPIFLASH_CS_EN +	| | | | 3-------  SMC0_LP0_EN    |  | | | | 3------- ~SD_WP_EN +	| | | | | 2-----  EMPTY          |  | | | | | 2----- ~SD_CD_EN +	| | | | | | 1---  SMC0_EPPI2     |  | | | | | | 1--- ~PUSHBUTTON2_EN +			  _LP1_SWITCH +	| | | | | | | 0-  OVERRIDE_SMC0  |  | | | | | | | 0- ~PUSHBUTTON1_EN +			  _LP0_BOOT +	| | | | | | | |                  |  | | | | | | | | +	O O O O O O O O                  |  O O O O O O O O   (I/O direction) +	0 0 0 0 0 X 0 1                  |  X 0 0 0 0 0 0 0   (value being set) +*/ +		.dir0 = 0x0, /* all output */ +		.dir1 = 0x0, /* all output */ +#ifdef CONFIG_BFIN_LINKPORT +		.value0 = OVERRIDE_SMC0_LP0_BOOT, +#else +		.value0 = SMC0_EPPI2_LP1_SWITCH, +#endif +		.value1 = 0x0, +	}, +	{ +/* +	U47 Port A                         U47 Port B + +	7--------------- ~PD2_SPI0MISO |  7---------------  EMPTY +			  _EI3_EN +	| 6------------- ~PD1_SPI0D3   |  | 6-------------  EMPTY +			  _EPPI1D17 +			  _SPI0SEL2 +			  _EI3_EN +	| | 5----------- ~PD0_SPI0D2   |  | | 5-----------  EMPTY +			  _EPPI1D16 +			  _SPI0SEL3 +			  _EI3_EN +	| | | 4--------- ~WAKE_PUSH    |  | | | 4---------  EMPTY +			  BUTTON_EN +	| | | | 3------- ~ETHERNET_EN  |  | | | | 3-------  EMPTY +	| | | | | 2-----  PHYAD0       |  | | | | | 2-----  EMPTY +	| | | | | | 1---  PHY_PWR      |  | | | | | | 1--- ~PD4_SPI0CK_EI3_EN +			  _DWN_INT +	| | | | | | | 0- ~PHYINT_EN    |  | | | | | | | 0- ~PD3_SPI0MOSI_EI3_EN +	| | | | | | | |                |  | | | | | | | | +	O O O O O I I O                |  O O O O O O O O   (I/O direction) +	1 1 1 0 0 0 0 0                |  X X X X X X 1 1   (value being set) +*/ +		.dir0 = 0x6, /* bits 1 and 2 input, all others output */ +		.dir1 = 0x0, /* all output */ +		.value0 = PD1_SPI0D3_EN | PD0_SPI0D2_EN, +		.value1 = 0, +	}, +}; + +static int setup_soft_switch(int addr, struct switch_config *config) +{ +	int ret = 0; + +	ret = i2c_write(addr, OLATA, 1, &config->value0, 1); +	if (ret) +		return ret; +	ret = i2c_write(addr, OLATB, 1, &config->value1, 1); +	if (ret) +		return ret; + +	ret = i2c_write(addr, IODIRA, 1, &config->dir0, 1); +	if (ret) +		return ret; +	return i2c_write(addr, IODIRB, 1, &config->dir1, 1); +} + +int config_switch_bit(int addr, int port, int bit, int dir, uchar value) +{ +	int ret, data_reg, dir_reg; +	uchar tmp; + +	if (port == IO_PORT_A) { +		data_reg = OLATA; +		dir_reg = IODIRA; +	} else { +		data_reg = OLATB; +		dir_reg = IODIRB; +	} + +	if (dir == IO_PORT_INPUT) { +		ret = i2c_read(addr, dir_reg, 1, &tmp, 1); +		if (ret) +			return ret; +		tmp |= bit; +		return i2c_write(addr, dir_reg, 1, &tmp, 1); +	} else { +		ret = i2c_read(addr, data_reg, 1, &tmp, 1); +		if (ret) +			return ret; +		if (value) +			tmp |= bit; +		else +			tmp &= ~bit; +		ret = i2c_write(addr, data_reg, 1, &tmp, 1); +		if (ret) +			return ret; +		ret = i2c_read(addr, dir_reg, 1, &tmp, 1); +		if (ret) +			return ret; +		tmp &= ~bit; +		return i2c_write(addr, dir_reg, 1, &tmp, 1); +	} +} + +int setup_board_switches(void) +{ +	int ret; +	int i; + +	for (i = 0; i < NUM_SWITCH; i++) { +		ret = setup_soft_switch(SWITCH_ADDR + i, +				&switch_config_array[i]); +		if (ret) +			return ret; +	} +	return 0; +} diff --git a/board/bf609-ezkit/soft_switch.h b/board/bf609-ezkit/soft_switch.h new file mode 100644 index 000000000..d147fe137 --- /dev/null +++ b/board/bf609-ezkit/soft_switch.h @@ -0,0 +1,80 @@ +/* + * U-boot - main board file + * + * Copyright (c) 2008-2011 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. + */ + +#ifndef __BOARD_SOFT_SWITCH_H__ +#define __BOARD_SOFT_SWITCH_H__ + +#include <asm/soft_switch.h> + +/* switch 0 port A */ +#define CAN_EN                 0x1 +#define CAN_STB                0x2 +#define CAN0_ERR_EN            0x4 +#define CAN0RX_EN              0x8 +#define CNT0UD_EN              0x10 +#define CNT0DG_EN              0x20 +#define CNT0ZM_EN              0x40 +#define RMII_CLK_EN            0x80 + +/* switch 0 port B */ +#define UART0RTS_EN            0x1 +#define UART0RX_EN             0x2 +#define UART0CTS_EN            0x4 +#define UART0CTS_RTS_LPBK      0x8 +#define UART0CTS_RST_EN        0x10 +#define UART0CTS_146_EN        0x20 +#define TEMP_IRQ_EN            0x40 +#define TEMP_THERM_EN          0x80 + +/* switch 1 port A */ +#define OVERRIDE_SMC0_LP0_BOOT 0x1 +#define SMC0_EPPI2_LP1_SWITCH  0x2 +#define SMC0_LP0_EN            0x8 +#define LED1_GPIO_EN           0x10 +#define LED2_GPIO_EN           0x20 +#define LED3_GPIO_EN           0x40 +#define LED4_GPIO_EN           0x80 + +/* switch 1 port B */ +#define PUSHBUTTON1_EN         0x1 +#define PUSHBUTTON2_EN         0x2 +#define SD_CD_EN               0x4 +#define SD_WP_EN               0x8 +#define SPIFLASH_CS_EN         0x10 +#define SPI0D2_EN              0x20 +#define SPI0D3_EN              0x40 + +/* switch 2 port A */ +#define PHYINT_EN              0x1 +#define PHY_PWR_DWN_INT        0x2 +#define PHYAD0                 0x4 +#define ETHERNET_EN            0x8 +#define WAKE_PUSHBUTTON_EN     0x10 +#define PD0_SPI0D2_EN          0x20 +#define PD1_SPI0D3_EN          0x40 +#define PD2_SPI0MISO_EN        0x80 + +/* switch 2 port B */ +#define PD3_SPI0MOSI_EN        0x1 +#define PD4_SPI0CK_EN          0x2 + +#ifdef CONFIG_BFIN_BOARD_VERSION_1_0 +#define SWITCH_ADDR     0x21 +#else +#define SWITCH_ADDR     0x20 +#endif + +#define NUM_SWITCH      3 +#define IODIRA          0x0 +#define IODIRB          0x1 +#define OLATA           0x14 +#define OLATB           0x15 + +int setup_board_switches(void); + +#endif /* __BOARD_SOFT_SWITCH_H__ */ diff --git a/board/boundary/nitrogen6x/nitrogen6dl.cfg b/board/boundary/nitrogen6x/nitrogen6dl.cfg index d6da96c5e..66257901d 100644 --- a/board/boundary/nitrogen6x/nitrogen6dl.cfg +++ b/board/boundary/nitrogen6x/nitrogen6dl.cfg @@ -19,7 +19,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/boundary/nitrogen6x/nitrogen6dl2g.cfg b/board/boundary/nitrogen6x/nitrogen6dl2g.cfg index 0b1c35c31..dccd4971f 100644 --- a/board/boundary/nitrogen6x/nitrogen6dl2g.cfg +++ b/board/boundary/nitrogen6x/nitrogen6dl2g.cfg @@ -19,7 +19,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/boundary/nitrogen6x/nitrogen6q.cfg b/board/boundary/nitrogen6x/nitrogen6q.cfg index 680a85368..e31737463 100644 --- a/board/boundary/nitrogen6x/nitrogen6q.cfg +++ b/board/boundary/nitrogen6x/nitrogen6q.cfg @@ -19,7 +19,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/boundary/nitrogen6x/nitrogen6q2g.cfg b/board/boundary/nitrogen6x/nitrogen6q2g.cfg index f57ab0eed..5a06220a3 100644 --- a/board/boundary/nitrogen6x/nitrogen6q2g.cfg +++ b/board/boundary/nitrogen6x/nitrogen6q2g.cfg @@ -19,7 +19,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/boundary/nitrogen6x/nitrogen6s.cfg b/board/boundary/nitrogen6x/nitrogen6s.cfg index b5af5cc1b..d7d5f29a5 100644 --- a/board/boundary/nitrogen6x/nitrogen6s.cfg +++ b/board/boundary/nitrogen6x/nitrogen6s.cfg @@ -19,7 +19,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/boundary/nitrogen6x/nitrogen6s1g.cfg b/board/boundary/nitrogen6x/nitrogen6s1g.cfg index 5aeefc878..cf2690ab1 100644 --- a/board/boundary/nitrogen6x/nitrogen6s1g.cfg +++ b/board/boundary/nitrogen6x/nitrogen6s1g.cfg @@ -19,7 +19,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index e155556ce..8f0f9b8de 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -336,7 +336,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {  void setup_spi(void)  { -	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);  	imx_iomux_v3_setup_multiple_pads(ecspi1_pads,  					 ARRAY_SIZE(ecspi1_pads));  } diff --git a/board/buffalo/lsxl/kwbimage-lschl.cfg b/board/buffalo/lsxl/kwbimage-lschl.cfg index 2b9b3cd1b..4ac381ec7 100644 --- a/board/buffalo/lsxl/kwbimage-lschl.cfg +++ b/board/buffalo/lsxl/kwbimage-lschl.cfg @@ -20,7 +20,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/buffalo/lsxl/kwbimage-lsxhl.cfg b/board/buffalo/lsxl/kwbimage-lsxhl.cfg index 8a94b6c71..c62f22cb4 100644 --- a/board/buffalo/lsxl/kwbimage-lsxhl.cfg +++ b/board/buffalo/lsxl/kwbimage-lsxhl.cfg @@ -20,7 +20,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/cloudengines/pogo_e02/kwbimage.cfg b/board/cloudengines/pogo_e02/kwbimage.cfg index a02e88d97..32c0cd53a 100644 --- a/board/cloudengines/pogo_e02/kwbimage.cfg +++ b/board/cloudengines/pogo_e02/kwbimage.cfg @@ -23,7 +23,7 @@  # You should have received a copy of the GNU General Public License  # along with this program; If not, see <http://www.gnu.org/licenses/>.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/congatec/cgtqmx6eval/Makefile b/board/congatec/cgtqmx6eval/Makefile new file mode 100644 index 000000000..ac16c1fe3 --- /dev/null +++ b/board/congatec/cgtqmx6eval/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2007, Guennadi Liakhovetski <lg@denx.de> +# +# (C) Copyright 2011 Freescale Semiconductor, Inc. +# (C) Copyright 2013 Adeneo Embedded <www.adeneo-embedded.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 $(TOPDIR)/config.mk + +LIB    = $(obj)lib$(BOARD).o + +COBJS  := cgtqmx6eval.o + +SRCS   := $(COBJS:.o=.c) +OBJS   := $(addprefix $(obj),$(COBJS)) + +$(LIB):        $(obj).depend $(OBJS) +	$(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/congatec/cgtqmx6eval/README b/board/congatec/cgtqmx6eval/README new file mode 100644 index 000000000..bbf0f75a4 --- /dev/null +++ b/board/congatec/cgtqmx6eval/README @@ -0,0 +1,29 @@ +U-Boot for the Congatec Conga-QEVAl Evaluation Carrier board with +qmx6 quad module. + +This file contains information for the port of U-Boot to the Congatec +Conga-QEVAl Evaluation Carrier board with qmx6 quad module. + +1. Boot source, boot from SD card +--------------------------------- + +This version of u-boot works only on the SD card. By default, the +Congatec board can boot only from the SPI-NOR. +But, with the u-boot version provided with the board you can write boot +registers to force the board to reboot and boot from the SD slot. If +"bmode" command is not available from your pre-installed u-boot, these +instruction will produce the same effect: + +conga-QMX6 U-Boot > mw.l 0x20d8040 0x3850 +conga-QMX6 U-Boot > mw.l 0x020d8044 0x10000000 +conga-QMX6 U-Boot > reset +resetting ... + +The the board will reboot and, if you have written your SD correctly +the board will use u-boot that live into the SD + +To copy the resulting u-boot.imx to the SD card: + + dd if=u-boot.imx of=/dev/xxx bs=512 seek=2 + +Note: Replace xxx with the device representing the SD card in your system. diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c new file mode 100644 index 000000000..f70f674b2 --- /dev/null +++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c @@ -0,0 +1,167 @@ +/* + * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. + * Based on mx6qsabrelite.c file + * Copyright (C) 2013, Adeneo Embedded <www.adeneo-embedded.com> + * Leo Sartre, <lsartre@adeneo-embedded.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/io.h> +#include <asm/arch/clock.h> +#include <asm/arch/imx-regs.h> +#include <asm/arch/iomux.h> +#include <asm/arch/mx6-pins.h> +#include <asm/gpio.h> +#include <asm/imx-common/iomux-v3.h> +#include <asm/imx-common/boot_mode.h> +#include <mmc.h> +#include <fsl_esdhc.h> + +DECLARE_GLOBAL_DATA_PTR; + +#define UART_PAD_CTRL  (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |\ +	PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS) + +#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP  | PAD_CTL_SPEED_LOW |\ +	PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS) + +int dram_init(void) +{ +	gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); + +	return 0; +} + +iomux_v3_cfg_t const uart2_pads[] = { +	MX6_PAD_EIM_D26__UART2_TXD | MUX_PAD_CTRL(UART_PAD_CTRL), +	MX6_PAD_EIM_D27__UART2_RXD | MUX_PAD_CTRL(UART_PAD_CTRL), +}; + +iomux_v3_cfg_t const usdhc2_pads[] = { +	MX6_PAD_SD2_CLK__USDHC2_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD2_CMD__USDHC2_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD2_DAT0__USDHC2_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD2_DAT1__USDHC2_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD2_DAT2__USDHC2_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD2_DAT3__USDHC2_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_GPIO_4__GPIO_1_4      | MUX_PAD_CTRL(USDHC_PAD_CTRL), +}; + +iomux_v3_cfg_t const usdhc4_pads[] = { +	MX6_PAD_SD4_CLK__USDHC4_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_CMD__USDHC4_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT0__USDHC4_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT1__USDHC4_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT2__USDHC4_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT3__USDHC4_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT4__USDHC4_DAT4 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT5__USDHC4_DAT5 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT6__USDHC4_DAT6 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_SD4_DAT7__USDHC4_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), +	MX6_PAD_NANDF_D6__GPIO_2_6    | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */ +}; + +static void setup_iomux_uart(void) +{ +	imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads)); +} + +#ifdef CONFIG_FSL_ESDHC +struct fsl_esdhc_cfg usdhc_cfg[] = { +	{USDHC2_BASE_ADDR}, +	{USDHC4_BASE_ADDR}, +}; + +int board_mmc_getcd(struct mmc *mmc) +{ +	struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; +	int ret = 0; + +	switch (cfg->esdhc_base) { +	case USDHC2_BASE_ADDR: +		gpio_direction_input(IMX_GPIO_NR(1, 4)); +		ret = !gpio_get_value(IMX_GPIO_NR(1, 4)); +		break; +	case USDHC4_BASE_ADDR: +		gpio_direction_input(IMX_GPIO_NR(2, 6)); +		ret = !gpio_get_value(IMX_GPIO_NR(2, 6)); +		break; +	default: +		printf("Bad USDHC interface\n"); +	} + +	return ret; +} + +int board_mmc_init(bd_t *bis) +{ +	s32 status = 0; + +	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); +	usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK); + +	imx_iomux_v3_setup_multiple_pads( +				usdhc2_pads, ARRAY_SIZE(usdhc2_pads)); +	imx_iomux_v3_setup_multiple_pads( +				usdhc4_pads, ARRAY_SIZE(usdhc4_pads)); + +	status = fsl_esdhc_initialize(bis, &usdhc_cfg[0]) | +		     fsl_esdhc_initialize(bis, &usdhc_cfg[1]); + +	return status; +} +#endif + +int board_early_init_f(void) +{ +	setup_iomux_uart(); + +	return 0; +} + +int board_init(void) +{ +	/* address of boot parameters */ +	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; + +	return 0; +} + +int checkboard(void) +{ +	puts("Board: Conga-QEVAL QMX6 Quad\n"); + +	return 0; +} + +#ifdef CONFIG_CMD_BMODE +static const struct boot_mode board_boot_modes[] = { +	/* 4 bit bus width */ +	{"mmc0",	MAKE_CFGVAL(0x50, 0x20, 0x00, 0x00)}, +	{"mmc1",	MAKE_CFGVAL(0x50, 0x38, 0x00, 0x00)}, +	{NULL,		0}, +}; +#endif + +int misc_init_r(void) +{ +#ifdef CONFIG_CMD_BMODE +	add_board_boot_modes(board_boot_modes); +#endif +	return 0; +} diff --git a/board/d-link/dns325/kwbimage.cfg b/board/d-link/dns325/kwbimage.cfg index 97cb090e4..6df793983 100644 --- a/board/d-link/dns325/kwbimage.cfg +++ b/board/d-link/dns325/kwbimage.cfg @@ -25,7 +25,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/davinci/da8xxevm/da830evm.c b/board/davinci/da8xxevm/da830evm.c index c45c94b4c..a4e925415 100644 --- a/board/davinci/da8xxevm/da830evm.c +++ b/board/davinci/da8xxevm/da830evm.c @@ -39,135 +39,43 @@  #include <asm/arch/hardware.h>  #include <asm/arch/emif_defs.h>  #include <asm/arch/emac_defs.h> +#include <asm/arch/pinmux_defs.h>  #include <asm/io.h>  #include <nand.h>  #include <asm/arch/nand_defs.h>  #include <asm/arch/davinci_misc.h> -DECLARE_GLOBAL_DATA_PTR; - -/* SPI0 pin muxer settings */ -static const struct pinmux_config spi0_pins[] = { -	{ pinmux(7), 1, 3 }, -	{ pinmux(7), 1, 4 }, -	{ pinmux(7), 1, 5 }, -	{ pinmux(7), 1, 6 }, -	{ pinmux(7), 1, 7 } -}; - -/* EMIF-A bus pins for 8-bit NAND support on CS3 */ -static const struct pinmux_config emifa_nand_pins[] = { -	{ pinmux(13), 1, 6 }, -	{ pinmux(13), 1, 7 }, -	{ pinmux(14), 1, 0 }, -	{ pinmux(14), 1, 1 }, -	{ pinmux(14), 1, 2 }, -	{ pinmux(14), 1, 3 }, -	{ pinmux(14), 1, 4 }, -	{ pinmux(14), 1, 5 }, -	{ pinmux(15), 1, 7 }, -	{ pinmux(16), 1, 0 }, -	{ pinmux(18), 1, 1 }, -	{ pinmux(18), 1, 4 }, -	{ pinmux(18), 1, 5 }, -}; - -/* EMAC PHY interface pins */ -static const struct pinmux_config emac_pins[] = { -	{ pinmux(9), 0, 5 }, -	{ pinmux(10), 2, 1 }, -	{ pinmux(10), 2, 2 }, -	{ pinmux(10), 2, 3 }, -	{ pinmux(10), 2, 4 }, -	{ pinmux(10), 2, 5 }, -	{ pinmux(10), 2, 6 }, -	{ pinmux(10), 2, 7 }, -	{ pinmux(11), 2, 0 }, -	{ pinmux(11), 2, 1 }, -}; - -/* UART pin muxer settings */ -static const struct pinmux_config uart_pins[] = { -	{ pinmux(8), 2, 7 }, -	{ pinmux(9), 2, 0 } -}; - -/* I2C pin muxer settings */ -static const struct pinmux_config i2c_pins[] = { -	{ pinmux(8), 2, 3 }, -	{ pinmux(8), 2, 4 } -}; - -#ifdef CONFIG_USE_NAND -/* NAND pin muxer settings */ -const struct pinmux_config aemif_pins[] = { -	{ pinmux(13), 1, 6 }, -	{ pinmux(13), 1, 7 }, -	{ pinmux(14), 1, 0 }, -	{ pinmux(14), 1, 1 }, -	{ pinmux(14), 1, 2 }, -	{ pinmux(14), 1, 3 }, -	{ pinmux(14), 1, 4 }, -	{ pinmux(14), 1, 5 }, -	{ pinmux(14), 1, 6 }, -	{ pinmux(14), 1, 7 }, -	{ pinmux(15), 1, 0 }, -	{ pinmux(15), 1, 1 }, -	{ pinmux(15), 1, 2 }, -	{ pinmux(15), 1, 3 }, -	{ pinmux(15), 1, 4 }, -	{ pinmux(15), 1, 5 }, -	{ pinmux(15), 1, 6 }, -	{ pinmux(15), 1, 7 }, -	{ pinmux(16), 1, 0 }, -	{ pinmux(16), 1, 1 }, -	{ pinmux(16), 1, 2 }, -	{ pinmux(16), 1, 3 }, -	{ pinmux(16), 1, 4 }, -	{ pinmux(16), 1, 5 }, -	{ pinmux(16), 1, 6 }, -	{ pinmux(16), 1, 7 }, -	{ pinmux(17), 1, 0 }, -	{ pinmux(17), 1, 1 }, -	{ pinmux(17), 1, 2 }, -	{ pinmux(17), 1, 3 }, -	{ pinmux(17), 1, 4 }, -	{ pinmux(17), 1, 5 }, -	{ pinmux(17), 1, 6 }, -	{ pinmux(17), 1, 7 }, -	{ pinmux(18), 1, 0 }, -	{ pinmux(18), 1, 1 }, -	{ pinmux(18), 1, 2 }, -	{ pinmux(18), 1, 3 }, -	{ pinmux(18), 1, 4 }, -	{ pinmux(18), 1, 5 }, -	{ pinmux(18), 1, 6 }, -	{ pinmux(18), 1, 7 }, -	{ pinmux(10), 1, 0 } -}; +#ifdef CONFIG_DAVINCI_MMC +#include <mmc.h> +#include <asm/arch/sdmmc_defs.h>  #endif - -/* USB0_DRVVBUS pin muxer settings */ -static const struct pinmux_config usb_pins[] = { -	{ pinmux(9), 1, 1 } -}; +DECLARE_GLOBAL_DATA_PTR;  static const struct pinmux_resource pinmuxes[] = {  #ifdef CONFIG_SPI_FLASH -	PINMUX_ITEM(spi0_pins), +	PINMUX_ITEM(spi0_pins_base), +	PINMUX_ITEM(spi0_pins_scs0), +	PINMUX_ITEM(spi0_pins_ena),  #endif -	PINMUX_ITEM(uart_pins), -	PINMUX_ITEM(i2c_pins), +	PINMUX_ITEM(uart2_pins_txrx), +	PINMUX_ITEM(i2c0_pins),  #ifdef CONFIG_USB_DA8XX  	PINMUX_ITEM(usb_pins),  #endif  #ifdef CONFIG_USE_NAND -	PINMUX_ITEM(emifa_nand_pins), -	PINMUX_ITEM(aemif_pins), +	PINMUX_ITEM(emifa_pins), +	PINMUX_ITEM(emifa_pins_cs0), +	PINMUX_ITEM(emifa_pins_cs2), +	PINMUX_ITEM(emifa_pins_cs3),  #endif  #if defined(CONFIG_DRIVER_TI_EMAC) -	PINMUX_ITEM(emac_pins), +	PINMUX_ITEM(emac_pins_rmii), +	PINMUX_ITEM(emac_pins_mdio), +	PINMUX_ITEM(emac_pins_rmii_clk_source), +#endif +#ifdef CONFIG_DAVINCI_MMC +	PINMUX_ITEM(mmc0_pins_8bit)  #endif  }; @@ -177,8 +85,31 @@ static const struct lpsc_resource lpsc[] = {  	{ DAVINCI_LPSC_EMAC },	/* image download */  	{ DAVINCI_LPSC_UART2 },	/* console */  	{ DAVINCI_LPSC_GPIO }, +#ifdef CONFIG_DAVINCI_MMC +	{ DAVINCI_LPSC_MMC_SD }, +#endif + +}; + +#ifdef CONFIG_DAVINCI_MMC +static struct davinci_mmc mmc_sd0 = { +	.reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE, +	.host_caps = MMC_MODE_8BIT, +	.voltages = MMC_VDD_32_33 | MMC_VDD_33_34, +	.version = MMC_CTLR_VERSION_2,  }; +int board_mmc_init(bd_t *bis) +{ +	mmc_sd0.input_clk = clk_get(DAVINCI_MMCSD_CLKID); + +	printf("%x\n", mmc_sd0.input_clk); + +	/* Add slot-0 to mmc subsystem */ +	return davinci_mmc_init(bis, &mmc_sd0); +} +#endif +  int board_init(void)  {  #ifndef CONFIG_USE_IRQ diff --git a/board/esg/ima3-mx53/imximage.cfg b/board/esg/ima3-mx53/imximage.cfg index fce7492f6..ab22385c8 100644 --- a/board/esg/ima3-mx53/imximage.cfg +++ b/board/esg/ima3-mx53/imximage.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c index 41887c2c7..a39c17a56 100644 --- a/board/freescale/b4860qds/b4860qds.c +++ b/board/freescale/b4860qds/b4860qds.c @@ -166,11 +166,13 @@ int configure_vsc3316_3308(void)  		ret = select_i2c_ch_pca(I2C_CH_VSC3316);  		if (!ret) {  			ret = vsc3316_config(VSC3316_TX_ADDRESS, -					vsc16_tx_sgmii_lane_ab, num_vsc16_con); +					vsc16_tx_4sfp_sgmii_12_56, +					num_vsc16_con);  			if (ret)  				return ret;  			ret = vsc3316_config(VSC3316_RX_ADDRESS, -					vsc16_rx_sgmii_lane_ab, num_vsc16_con); +					vsc16_rx_4sfp_sgmii_12_56, +					num_vsc16_con);  			if (ret)  				return ret;  		} else { diff --git a/board/freescale/b4860qds/b4860qds_crossbar_con.h b/board/freescale/b4860qds/b4860qds_crossbar_con.h index 994dec570..c2b6c44d2 100644 --- a/board/freescale/b4860qds/b4860qds_crossbar_con.h +++ b/board/freescale/b4860qds/b4860qds_crossbar_con.h @@ -26,42 +26,53 @@  static const int8_t vsc16_tx_amc[8][2] = { {15, 3}, {0, 2}, {7, 4}, {9, 10},  				{5, 11}, {4, 5}, {2, 6}, {12, 9} }; -static const int8_t vsc16_tx_sfp[8][2] = { {15, 8}, {0, 0}, {7, 7}, {9, 1}, -				{5, 15}, {4, 14}, {2, 12}, {12, 13} }; +static const int8_t vsc16_tx_sfp[8][2] = { {15, 7}, {0, 1}, {7, 8}, {9, 0}, +				{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} }; -static const int8_t vsc16_tx_sgmii_lane_ab[8][2] = { {2, 14}, {12, 15}, -		{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} }; +static const int8_t vsc16_tx_4sfp_sgmii_12_56[8][2] = { {15, 7}, {0, 1}, +				{7, 8}, {9, 0}, {2, 14}, {12, 15}, +				{-1, -1}, {-1, -1} }; + +static const int8_t vsc16_tx_4sfp_sgmii_34[8][2] = { {15, 7}, {0, 1}, +				{7, 8}, {9, 0}, {5, 14}, {4, 15}, +				{-1, -1}, {-1, -1} };  #ifdef CONFIG_PPC_B4420  static const int8_t vsc16_tx_sgmii_lane_cd[8][2] = { {5, 14}, {4, 15},  		{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };  #endif +  static const int8_t vsc16_tx_aurora[8][2] = { {2, 13}, {12, 12}, {-1, -1},  			{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };  static const int8_t vsc16_rx_amc[8][2] = { {3, 15}, {2, 1}, {4, 8}, {10, 9},  				{11, 11}, {5, 10}, {6, 3}, {9, 12} }; -static const int8_t vsc16_rx_sfp[8][2] = { {0, 15}, {8, 1}, {1, 8}, {7, 9}, +static const int8_t vsc16_rx_sfp[8][2] = { {8, 15}, {0, 1}, {7, 8}, {1, 9},  				{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} }; -static const int8_t vsc16_rx_sgmii_lane_ab[8][2] = { {14, 3}, {15, 12}, -		{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} }; +static const int8_t vsc16_rx_4sfp_sgmii_12_56[8][2] = { {8, 15}, {0, 1}, +				{7, 8}, {1, 9}, {14, 3}, {15, 12}, +				{-1, -1}, {-1, -1} }; + +static const int8_t vsc16_rx_4sfp_sgmii_34[8][2] = { {8, 15}, {0, 1}, +				{7, 8}, {1, 9}, {14, 11}, {15, 10}, +				{-1, -1}, {-1, -1} };  #ifdef CONFIG_PPC_B4420  static const int8_t vsc16_rx_sgmii_lane_cd[8][2] = { {14, 11}, {15, 10},  		{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };  #endif -static const int8_t vsc16_rx_aurora[8][2] = { {12, 3}, {13, 12}, {-1, -1}, +static const int8_t vsc16_rx_aurora[8][2] = { {13, 3}, {12, 12}, {-1, -1},  			{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1} };  static const int8_t vsc08_tx_amc[4][2] = { {2, 2}, {3, 3}, {7, 4}, {1, 5} }; -static const int8_t vsc08_tx_sfp[4][2] = { {2, 6}, {3, 7}, {7, 1}, {1, 0} }; +static const int8_t vsc08_tx_sfp[4][2] = { {2, 1}, {3, 0}, {7, 6}, {1, 7} };  static const int8_t vsc08_rx_amc[4][2] = { {2, 3}, {3, 4}, {4, 7}, {5, 1} }; -static const int8_t vsc08_rx_sfp[4][2] = { {6, 3}, {7, 4}, {1, 7}, {0, 1} }; +static const int8_t vsc08_rx_sfp[4][2] = { {1, 3}, {0, 4}, {6, 7}, {7, 1} };  #endif diff --git a/board/freescale/b4860qds/ddr.c b/board/freescale/b4860qds/ddr.c index dd4c0f69e..b82b3d409 100644 --- a/board/freescale/b4860qds/ddr.c +++ b/board/freescale/b4860qds/ddr.c @@ -13,6 +13,7 @@  #include <asm/fsl_ddr_sdram.h>  #include <asm/fsl_ddr_dimm_params.h>  #include <asm/fsl_law.h> +#include <../arch/powerpc/cpu/mpc8xxx/ddr/ddr.h>  DECLARE_GLOBAL_DATA_PTR; @@ -188,3 +189,74 @@ phys_size_t initdram(int board_type)  	puts("    DDR: ");  	return dram_size;  } + +unsigned long long step_assign_addresses(fsl_ddr_info_t *pinfo, +			  unsigned int dbw_cap_adj[]) +{ +	int i, j; +	unsigned long long total_mem, current_mem_base, total_ctlr_mem; +	unsigned long long rank_density, ctlr_density = 0; + +	current_mem_base = 0ull; +	total_mem = 0; +	/* +	 * This board has soldered DDR chips. DDRC1 has two rank. +	 * DDRC2 has only one rank. +	 * Assigning DDRC2 to lower address and DDRC1 to higher address. +	 */ +	if (pinfo->memctl_opts[0].memctl_interleaving) { +		rank_density = pinfo->dimm_params[0][0].rank_density >> +					dbw_cap_adj[0]; +		ctlr_density = rank_density; + +		debug("rank density is 0x%llx, ctlr density is 0x%llx\n", +		      rank_density, ctlr_density); +		for (i = CONFIG_NUM_DDR_CONTROLLERS - 1; i >= 0; i--) { +			switch (pinfo->memctl_opts[i].memctl_interleaving_mode) { +			case FSL_DDR_CACHE_LINE_INTERLEAVING: +			case FSL_DDR_PAGE_INTERLEAVING: +			case FSL_DDR_BANK_INTERLEAVING: +			case FSL_DDR_SUPERBANK_INTERLEAVING: +				total_ctlr_mem = 2 * ctlr_density; +				break; +			default: +				panic("Unknown interleaving mode"); +			} +			pinfo->common_timing_params[i].base_address = +						current_mem_base; +			pinfo->common_timing_params[i].total_mem = +						total_ctlr_mem; +			total_mem = current_mem_base + total_ctlr_mem; +			debug("ctrl %d base 0x%llx\n", i, current_mem_base); +			debug("ctrl %d total 0x%llx\n", i, total_ctlr_mem); +		} +	} else { +		/* +		 * Simple linear assignment if memory +		 * controllers are not interleaved. +		 */ +		for (i = CONFIG_NUM_DDR_CONTROLLERS - 1; i >= 0; i--) { +			total_ctlr_mem = 0; +			pinfo->common_timing_params[i].base_address = +						current_mem_base; +			for (j = 0; j < CONFIG_DIMM_SLOTS_PER_CTLR; j++) { +				/* Compute DIMM base addresses. */ +				unsigned long long cap = +					pinfo->dimm_params[i][j].capacity; +				pinfo->dimm_params[i][j].base_address = +					current_mem_base; +				debug("ctrl %d dimm %d base 0x%llx\n", +				      i, j, current_mem_base); +				current_mem_base += cap; +				total_ctlr_mem += cap; +			} +			debug("ctrl %d total 0x%llx\n", i, total_ctlr_mem); +			pinfo->common_timing_params[i].total_mem = +							total_ctlr_mem; +			total_mem += total_ctlr_mem; +		} +	} +	debug("Total mem by %s is 0x%llx\n", __func__, total_mem); + +	return total_mem; +} diff --git a/board/freescale/b4860qds/eth_b4860qds.c b/board/freescale/b4860qds/eth_b4860qds.c index 68e2725fc..3bcda6d13 100644 --- a/board/freescale/b4860qds/eth_b4860qds.c +++ b/board/freescale/b4860qds/eth_b4860qds.c @@ -275,6 +275,24 @@ int board_eth_init(bd_t *bis)  		fm_info_set_phy_address(FM1_DTSEC4,  				CONFIG_SYS_FM1_DTSEC2_RISER_PHY_ADDR);  		break; +	case 0x98: +		/* XAUI in Slot1 and Slot2 */ +		debug("Setting phy addresses on B4860 QDS AMC2PEX-2S for FM1_10GEC1: %x\n", +		      CONFIG_SYS_FM1_10GEC1_PHY_ADDR); +		fm_info_set_phy_address(FM1_10GEC1, +					CONFIG_SYS_FM1_10GEC1_PHY_ADDR); +		debug("Setting phy addresses on B4860 QDS AMC2PEX-2S for FM1_10GEC2: %x\n", +		      CONFIG_SYS_FM1_10GEC2_PHY_ADDR); +		fm_info_set_phy_address(FM1_10GEC2, +					CONFIG_SYS_FM1_10GEC2_PHY_ADDR); +		break; +	case 0x9E: +		/* XAUI in Slot2 */ +		debug("Setting phy addresses on B4860 QDS AMC2PEX-2S for FM1_10GEC2: %x\n", +		      CONFIG_SYS_FM1_10GEC2_PHY_ADDR); +		fm_info_set_phy_address(FM1_10GEC2, +					CONFIG_SYS_FM1_10GEC2_PHY_ADDR); +		break;  	default:  		printf("Fman:  Unsupported SerDes2 Protocol 0x%02x\n",  				serdes2_prtcl); @@ -300,6 +318,23 @@ int board_eth_init(bd_t *bis)  		}  	} +	for (i = FM1_10GEC1; i < FM1_10GEC1 + CONFIG_SYS_NUM_FM1_10GEC; i++) { +		int idx = i - FM1_10GEC1; + +		switch (fm_info_get_enet_if(i)) { +		case PHY_INTERFACE_MODE_XGMII: +			fm_info_set_mdio(i, +					 miiphy_get_dev_by_name(DEFAULT_FM_TGEC_MDIO_NAME)); +			break; +		default: +			printf("Fman1: 10GSEC%u set to unknown interface %i\n", +			       idx + 1, fm_info_get_enet_if(i)); +			fm_info_set_phy_address(i, 0); +			break; +		} +	} + +  	cpu_eth_init(bis);  #endif diff --git a/board/freescale/b4860qds/law.c b/board/freescale/b4860qds/law.c index 4142e014d..b26725b2f 100644 --- a/board/freescale/b4860qds/law.c +++ b/board/freescale/b4860qds/law.c @@ -33,8 +33,12 @@ struct law_entry law_table[] = {  	SET_LAW(CONFIG_SYS_QMAN_MEM_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_QMAN),  #endif  	SET_LAW(QIXIS_BASE_PHYS, LAW_SIZE_4K, LAW_TRGT_IF_IFC), +#ifdef CONFIG_SYS_MAPLE_MEM_PHYS +	SET_LAW(CONFIG_SYS_MAPLE_MEM_PHYS, LAW_SIZE_16M, LAW_TRGT_IF_MAPLE), +#endif  #ifdef CONFIG_SYS_DCSRBAR_PHYS -	SET_LAW(CONFIG_SYS_DCSRBAR_PHYS, LAW_SIZE_4M, LAW_TRGT_IF_DCSR), +	/* Limit DCSR to 32M to access NPC Trace Buffer */ +	SET_LAW(CONFIG_SYS_DCSRBAR_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_DCSR),  #endif  #ifdef CONFIG_SYS_NAND_BASE_PHYS  	SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_IFC), diff --git a/board/freescale/b4860qds/tlb.c b/board/freescale/b4860qds/tlb.c index 6d634bf69..29cc41bfa 100644 --- a/board/freescale/b4860qds/tlb.c +++ b/board/freescale/b4860qds/tlb.c @@ -106,7 +106,7 @@ struct fsl_e_tlb_entry tlb_table[] = {  #ifdef CONFIG_SYS_DCSRBAR_PHYS  	SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,  		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, -		      0, 10, BOOKE_PAGESZ_4M, 1), +		      0, 10, BOOKE_PAGESZ_32M, 1),  #endif  #ifdef CONFIG_SYS_NAND_BASE  	/* diff --git a/board/freescale/common/qixis.h b/board/freescale/common/qixis.h index 8d914d548..2cf87383d 100644 --- a/board/freescale/common/qixis.h +++ b/board/freescale/common/qixis.h @@ -78,7 +78,11 @@ struct qixis {  	u8 trig_stat;  	u8 res12[3];  	u8 trig_ctr[4]; -	u8 res13[48]; +	u8 res13[16]; +	u8 clk_freq[6];	/* Clock Measurement Registers */ +	u8 res_c6[8]; +	u8 clk_base[2];	/* Clock Frequency Base Reg */ +	u8 res_d0[16];  	u8 aux2[4];	/* Auxiliary Registers,0xE0 */  	u8 res14[10];  	u8 aux_ad; diff --git a/board/freescale/corenet_ds/eth_superhydra.c b/board/freescale/corenet_ds/eth_superhydra.c index ef9de25bd..ae0707353 100644 --- a/board/freescale/corenet_ds/eth_superhydra.c +++ b/board/freescale/corenet_ds/eth_superhydra.c @@ -605,8 +605,8 @@ int board_eth_init(bd_t *bis)  	lane = serdes_get_first_lane(XAUI_FM1);  	if (lane >= 0) {  		debug("FM1@TGEC1 expects XAUI in slot %u\n", lane_to_slot[lane]); -		mdio_mux[FM1_10GEC1].mask = BRDCFG1_EMI2_SEL_MASK; -		mdio_mux[FM1_10GEC1].val = BRDCFG1_EMI2_SEL_SLOT2; +		mdio_mux[i].mask = BRDCFG1_EMI2_SEL_MASK; +		mdio_mux[i].val = BRDCFG1_EMI2_SEL_SLOT2;  		super_hydra_mdio_set_mux("SUPER_HYDRA_FM1_TGEC_MDIO",  					mdio_mux[i].mask, mdio_mux[i].val);  	} @@ -704,8 +704,8 @@ int board_eth_init(bd_t *bis)  	lane = serdes_get_first_lane(XAUI_FM2);  	if (lane >= 0) {  		debug("FM2@TGEC1 expects XAUI in slot %u\n", lane_to_slot[lane]); -		mdio_mux[FM2_10GEC1].mask = BRDCFG1_EMI2_SEL_MASK; -		mdio_mux[FM2_10GEC1].val = BRDCFG1_EMI2_SEL_SLOT1; +		mdio_mux[i].mask = BRDCFG1_EMI2_SEL_MASK; +		mdio_mux[i].val = BRDCFG1_EMI2_SEL_SLOT1;  		super_hydra_mdio_set_mux("SUPER_HYDRA_FM2_TGEC_MDIO",  					mdio_mux[i].mask, mdio_mux[i].val);  	} diff --git a/board/freescale/corenet_ds/pbi.cfg b/board/freescale/corenet_ds/pbi.cfg index 50806ca8a..af1ebd6f2 100644 --- a/board/freescale/corenet_ds/pbi.cfg +++ b/board/freescale/corenet_ds/pbi.cfg @@ -19,7 +19,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.pblimage for more details about how-to configure +# Refer doc/README.pblimage for more details about how-to configure  # and create PBL boot image  # diff --git a/board/freescale/corenet_ds/rcw_p5040ds.cfg b/board/freescale/corenet_ds/rcw_p5040ds.cfg new file mode 100644 index 000000000..82fa7417d --- /dev/null +++ b/board/freescale/corenet_ds/rcw_p5040ds.cfg @@ -0,0 +1,11 @@ +# +# Default RCW for P5040DS. +# + +#PBL preamble and RCW header +aa55aa55 010e0100 +#64 bytes RCW data +0c580000 00000000 22121200 00000000 +089c4400 00283000 58000000 61000000 +00000000 00000000 00000000 10070000 +00000000 00000000 00000000 00000000 diff --git a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg index 996d788dd..bae5c2320 100644 --- a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg +++ b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx23evk/mx23evk.c b/board/freescale/mx23evk/mx23evk.c index 41ba303ec..d25e2b37c 100644 --- a/board/freescale/mx23evk/mx23evk.c +++ b/board/freescale/mx23evk/mx23evk.c @@ -43,6 +43,12 @@ int board_early_init_f(void)  	/* SSP0 clock at 96MHz */  	mxs_set_sspclk(MXC_SSPCLK0, 96000, 0); +	/* Power on LCD */ +	gpio_direction_output(MX23_PAD_LCD_RESET__GPIO_1_18, 1); + +	/* Set contrast to maximum */ +	gpio_direction_output(MX23_PAD_PWM2__GPIO_1_28, 1); +  	return 0;  } diff --git a/board/freescale/mx23evk/spl_boot.c b/board/freescale/mx23evk/spl_boot.c index 6be8c8d9d..fd71f7dc1 100644 --- a/board/freescale/mx23evk/spl_boot.c +++ b/board/freescale/mx23evk/spl_boot.c @@ -27,6 +27,7 @@  #define	MUX_CONFIG_SSP1	(MXS_PAD_8MA | MXS_PAD_PULLUP)  #define	MUX_CONFIG_EMI	(MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_PULLUP) +#define	MUX_CONFIG_LCD	(MXS_PAD_4MA | MXS_PAD_NOPULL)  const iomux_cfg_t iomux_setup[] = {  	/* DUART */ @@ -96,6 +97,37 @@ const iomux_cfg_t iomux_setup[] = {  	/* Slot Power Enable */  	MX23_PAD_PWM3__GPIO_1_29 |  		(MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL), +	/* LCD */ +	MX23_PAD_LCD_D00__LCD_D00 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D01__LCD_D01 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D02__LCD_D02 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D03__LCD_D03 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D04__LCD_D04 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D05__LCD_D05 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D06__LCD_D06 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D07__LCD_D07 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D08__LCD_D08 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D09__LCD_D09 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D10__LCD_D10 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D11__LCD_D11 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D12__LCD_D12 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D13__LCD_D13 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D14__LCD_D14 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D15__LCD_D15 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D16__LCD_D16 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_D17__LCD_D17 | MUX_CONFIG_LCD, +	MX23_PAD_GPMI_D08__LCD_D18 | MUX_CONFIG_LCD, +	MX23_PAD_GPMI_D09__LCD_D19 | MUX_CONFIG_LCD, +	MX23_PAD_GPMI_D10__LCD_D20 | MUX_CONFIG_LCD, +	MX23_PAD_GPMI_D11__LCD_D21 | MUX_CONFIG_LCD, +	MX23_PAD_GPMI_D12__LCD_D22 | MUX_CONFIG_LCD, +	MX23_PAD_GPMI_D13__LCD_D23 | MUX_CONFIG_LCD, +	MX23_PAD_LCD_DOTCK__LCD_DOTCK | MUX_CONFIG_LCD, +	MX23_PAD_LCD_ENABLE__LCD_ENABLE | MUX_CONFIG_LCD, +	MX23_PAD_LCD_HSYNC__LCD_HSYNC | MUX_CONFIG_LCD, +	MX23_PAD_LCD_VSYNC__LCD_VSYNC | MUX_CONFIG_LCD, +	MX23_PAD_LCD_RESET__GPIO_1_18 | MUX_CONFIG_LCD, /* LCD power */ +	MX23_PAD_PWM2__GPIO_1_28 | MUX_CONFIG_LCD, /* LCD contrast */  };  #define HW_DRAM_CTL14	(0x38 >> 2) diff --git a/board/freescale/mx25pdk/imximage.cfg b/board/freescale/mx25pdk/imximage.cfg index c42a2836f..8cc8bde6c 100644 --- a/board/freescale/mx25pdk/imximage.cfg +++ b/board/freescale/mx25pdk/imximage.cfg @@ -15,7 +15,7 @@   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the   * GNU General Public License for more details.   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx28evk/iomux.c b/board/freescale/mx28evk/iomux.c index ae6eda343..beae0e66e 100644 --- a/board/freescale/mx28evk/iomux.c +++ b/board/freescale/mx28evk/iomux.c @@ -30,6 +30,7 @@  #define	MUX_CONFIG_ENET	(MXS_PAD_3V3 | MXS_PAD_8MA | MXS_PAD_PULLUP)  #define	MUX_CONFIG_EMI	(MXS_PAD_3V3 | MXS_PAD_12MA | MXS_PAD_NOPULL)  #define	MUX_CONFIG_SSP2	(MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_PULLUP) +#define	MUX_CONFIG_LCD	(MXS_PAD_3V3 | MXS_PAD_4MA | MXS_PAD_NOPULL)  const iomux_cfg_t iomux_setup[] = {  	/* DUART */ @@ -162,6 +163,38 @@ const iomux_cfg_t iomux_setup[] = {  	/* I2C */  	MX28_PAD_I2C0_SCL__I2C0_SCL,  	MX28_PAD_I2C0_SDA__I2C0_SDA, + +	/* LCD */ +	MX28_PAD_LCD_D00__LCD_D0 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D01__LCD_D1 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D02__LCD_D2 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D03__LCD_D3 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D04__LCD_D4 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D05__LCD_D5 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D06__LCD_D6 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D07__LCD_D7 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D08__LCD_D8 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D09__LCD_D9 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D10__LCD_D10 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D11__LCD_D11 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D12__LCD_D12 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D13__LCD_D13 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D14__LCD_D14 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D15__LCD_D15 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D16__LCD_D16 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D17__LCD_D17 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D18__LCD_D18 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D19__LCD_D19 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D20__LCD_D20 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D21__LCD_D21 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D22__LCD_D22 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_D23__LCD_D23 | MUX_CONFIG_LCD, +	MX28_PAD_LCD_RD_E__LCD_VSYNC | MUX_CONFIG_LCD, +	MX28_PAD_LCD_WR_RWN__LCD_HSYNC | MUX_CONFIG_LCD, +	MX28_PAD_LCD_RS__LCD_DOTCLK | MUX_CONFIG_LCD, +	MX28_PAD_LCD_CS__LCD_ENABLE | MUX_CONFIG_LCD, +	MX28_PAD_LCD_RESET__GPIO_3_30 | MUX_CONFIG_LCD, /* LCD power */ +	MX28_PAD_PWM2__GPIO_3_18 | MUX_CONFIG_LCD, /* LCD contrast */  };  #define HW_DRAM_CTL29	(0x74 >> 2) diff --git a/board/freescale/mx28evk/mx28evk.c b/board/freescale/mx28evk/mx28evk.c index de7231bd1..4edd9f419 100644 --- a/board/freescale/mx28evk/mx28evk.c +++ b/board/freescale/mx28evk/mx28evk.c @@ -59,6 +59,12 @@ int board_early_init_f(void)  	gpio_direction_output(MX28_PAD_AUART2_RX__GPIO_3_8, 1);  #endif +	/* Power on LCD */ +	gpio_direction_output(MX28_PAD_LCD_RESET__GPIO_3_30, 1); + +	/* Set contrast to maximum */ +	gpio_direction_output(MX28_PAD_PWM2__GPIO_3_18, 1); +  	return 0;  } diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c index 49158bd90..4f6cfeeaa 100644 --- a/board/freescale/mx31pdk/mx31pdk.c +++ b/board/freescale/mx31pdk/mx31pdk.c @@ -39,7 +39,21 @@ DECLARE_GLOBAL_DATA_PTR;  #ifdef CONFIG_SPL_BUILD  void board_init_f(ulong bootflag)  { -	relocate_code(CONFIG_SPL_TEXT_BASE); +	/* +	 * copy ourselves from where we are running to where we were +	 * linked at. Use ulong pointers as all addresses involved +	 * are 4-byte-aligned. +	 */ +	ulong *start_ptr, *end_ptr, *link_ptr, *run_ptr, *dst; +	asm volatile ("ldr %0, =_start" : "=r"(start_ptr)); +	asm volatile ("ldr %0, =_end" : "=r"(end_ptr)); +	asm volatile ("ldr %0, =board_init_f" : "=r"(link_ptr)); +	asm volatile ("adr %0, board_init_f" : "=r"(run_ptr)); +	for (dst = start_ptr; dst < end_ptr; dst++) +		*dst = *(dst+(run_ptr-link_ptr)); +	/* +	 * branch to nand_boot's link-time address. +	 */  	asm volatile("ldr pc, =nand_boot");  }  #endif diff --git a/board/freescale/mx51evk/imximage.cfg b/board/freescale/mx51evk/imximage.cfg index 3e141eef3..aaa490a74 100644 --- a/board/freescale/mx51evk/imximage.cfg +++ b/board/freescale/mx51evk/imximage.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx53ard/imximage_dd3.cfg b/board/freescale/mx53ard/imximage_dd3.cfg index 4633e4d38..a103d9553 100644 --- a/board/freescale/mx53ard/imximage_dd3.cfg +++ b/board/freescale/mx53ard/imximage_dd3.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx53evk/imximage.cfg b/board/freescale/mx53evk/imximage.cfg index 1cd61d56c..c1cfddaf4 100644 --- a/board/freescale/mx53evk/imximage.cfg +++ b/board/freescale/mx53evk/imximage.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx53loco/imximage.cfg b/board/freescale/mx53loco/imximage.cfg index e6b90c116..2f75ad051 100644 --- a/board/freescale/mx53loco/imximage.cfg +++ b/board/freescale/mx53loco/imximage.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx53smd/imximage.cfg b/board/freescale/mx53smd/imximage.cfg index 4633e4d38..a103d9553 100644 --- a/board/freescale/mx53smd/imximage.cfg +++ b/board/freescale/mx53smd/imximage.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx6qarm2/imximage.cfg b/board/freescale/mx6qarm2/imximage.cfg index 4ed211eed..6f18b3700 100644 --- a/board/freescale/mx6qarm2/imximage.cfg +++ b/board/freescale/mx6qarm2/imximage.cfg @@ -20,7 +20,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx6qsabreauto/imximage.cfg b/board/freescale/mx6qsabreauto/imximage.cfg index bbff81395..e720c6b53 100644 --- a/board/freescale/mx6qsabreauto/imximage.cfg +++ b/board/freescale/mx6qsabreauto/imximage.cfg @@ -19,7 +19,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c index bfe4868e8..2a6e3a919 100644 --- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c +++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c @@ -26,12 +26,14 @@  #include <asm/errno.h>  #include <asm/gpio.h>  #include <asm/imx-common/iomux-v3.h> +#include <asm/imx-common/mxc_i2c.h>  #include <asm/imx-common/boot_mode.h>  #include <mmc.h>  #include <fsl_esdhc.h>  #include <miiphy.h>  #include <netdev.h>  #include <asm/arch/sys_proto.h> +#include <i2c.h>  DECLARE_GLOBAL_DATA_PTR; @@ -46,6 +48,12 @@ DECLARE_GLOBAL_DATA_PTR;  #define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |			\  	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS) +#define I2C_PAD_CTRL	(PAD_CTL_PUS_100K_UP |			\ +	PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |	\ +	PAD_CTL_ODE | PAD_CTL_SRE_FAST) + +#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) +  int dram_init(void)  {  	gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); @@ -76,6 +84,45 @@ iomux_v3_cfg_t const enet_pads[] = {  	MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL	| MUX_PAD_CTRL(ENET_PAD_CTRL),  }; +/* I2C2 PMIC, iPod, Tuner, Codec, Touch, HDMI EDID, MIPI CSI2 card */ +struct i2c_pads_info i2c_pad_info1 = { +	.scl = { +		.i2c_mode = MX6_PAD_EIM_EB2__I2C2_SCL | PC, +		.gpio_mode = MX6_PAD_EIM_EB2__GPIO_2_30 | PC, +		.gp = IMX_GPIO_NR(2, 30) +	}, +	.sda = { +		.i2c_mode = MX6_PAD_KEY_ROW3__I2C2_SDA | PC, +		.gpio_mode = MX6_PAD_KEY_ROW3__GPIO_4_13 | PC, +		.gp = IMX_GPIO_NR(4, 13) +	} +}; + +/* + * I2C3 MLB, Port Expanders (A, B, C), Video ADC, Light Sensor, + * Compass Sensor, Accelerometer, Res Touch + */ +struct i2c_pads_info i2c_pad_info2 = { +	.scl = { +		.i2c_mode = MX6_PAD_GPIO_3__I2C3_SCL | PC, +		.gpio_mode = MX6_PAD_GPIO_3__GPIO_1_3 | PC, +		.gp = IMX_GPIO_NR(1, 3) +	}, +	.sda = { +		.i2c_mode = MX6_PAD_EIM_D18__I2C3_SDA | PC, +		.gpio_mode = MX6_PAD_EIM_D18__GPIO_3_18 | PC, +		.gp = IMX_GPIO_NR(3, 18) +	} +}; + +iomux_v3_cfg_t const i2c3_pads[] = { +	MX6_PAD_EIM_A24__GPIO_5_4		| MUX_PAD_CTRL(NO_PAD_CTRL), +}; + +iomux_v3_cfg_t const port_exp[] = { +	MX6_PAD_SD2_DAT0__GPIO_1_15		| MUX_PAD_CTRL(NO_PAD_CTRL), +}; +  static void setup_iomux_enet(void)  {  	imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads)); @@ -216,6 +263,16 @@ int board_init(void)  	/* address of boot parameters */  	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; +	/* I2C 2 and 3 setup - I2C 3 hw mux with EIM */ +	setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info1); +	/* I2C 3 Steer */ +	gpio_direction_output(IMX_GPIO_NR(5, 4), 1); +	imx_iomux_v3_setup_multiple_pads(i2c3_pads, ARRAY_SIZE(i2c3_pads)); +	setup_i2c(2, CONFIG_SYS_I2C_SPEED, 0x7f, &i2c_pad_info2); + +	gpio_direction_output(IMX_GPIO_NR(1, 15), 1); +	imx_iomux_v3_setup_multiple_pads(port_exp, ARRAY_SIZE(port_exp)); +  	return 0;  } diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c b/board/freescale/mx6qsabrelite/mx6qsabrelite.c index 8ce054e42..862bc3099 100644 --- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c +++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c @@ -308,7 +308,6 @@ iomux_v3_cfg_t const ecspi1_pads[] = {  void setup_spi(void)  { -	gpio_direction_output(CONFIG_SF_DEFAULT_CS, 1);  	imx_iomux_v3_setup_multiple_pads(ecspi1_pads,  					 ARRAY_SIZE(ecspi1_pads));  } diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c index a706a6d00..44d3e0c61 100644 --- a/board/freescale/p2041rdb/p2041rdb.c +++ b/board/freescale/p2041rdb/p2041rdb.c @@ -227,6 +227,17 @@ int misc_init_r(void)  				"'00' is unsupported\n");  		else  			actual[i] = freq[i][clock]; + +		/* +		 * PC board uses a different CPLD with PB board, this CPLD +		 * has cpld_ver_sub = 1, and pcba_ver = 5. But CPLD on PB +		 * board has cpld_ver_sub = 0, and pcba_ver = 4. +		 */ +		if ((i == 1) && (CPLD_READ(cpld_ver_sub) == 1) && +		    (CPLD_READ(pcba_ver) == 5)) { +			/* PC board bank2 frequency */ +			actual[i] = freq[i-1][clock]; +		}  	}  	for (i = 0; i < NUM_SRDS_BANKS; i++) { diff --git a/board/freescale/t4qds/ddr.c b/board/freescale/t4qds/ddr.c index 692616aed..058d62511 100644 --- a/board/freescale/t4qds/ddr.c +++ b/board/freescale/t4qds/ddr.c @@ -19,6 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;  struct board_specific_parameters {  	u32 n_ranks;  	u32 datarate_mhz_high; +	u32 rank_gb;  	u32 clk_adjust;  	u32 wrlvl_start;  	u32 wrlvl_ctl_2; @@ -36,16 +37,19 @@ struct board_specific_parameters {  static const struct board_specific_parameters udimm0[] = {  	/*  	 * memory controller 0 -	 *   num|  hi|  clk| wrlvl |   wrlvl   |  wrlvl | cpo  |wrdata|2T -	 * ranks| mhz|adjst| start |   ctl2    |  ctl3  |      |delay | +	 *   num|  hi| rank|  clk| wrlvl |   wrlvl   |  wrlvl | cpo  |wrdata|2T +	 * ranks| mhz| GB  |adjst| start |   ctl2    |  ctl3  |      |delay |  	 */ -	{2,  1350,    5,     7, 0x0809090b, 0x0c0c0d09,   0xff,    2,  0}, -	{2,  1666,    5,     8, 0x080a0a0c, 0x0c0d0e0a,   0xff,    2,  0}, -	{2,  2140,    5,     8, 0x090a0b0c, 0x0e0f100b,   0xff,    2,  0}, -	{1,  1350,    5,     8, 0x0809090b, 0x0c0c0d0a,   0xff,    2,  0}, -	{1,  1700,    5,     8, 0x080a0a0c, 0x0c0d0e0a,   0xff,    2,  0}, -	{1,  1900,    4,     8, 0x080a0a0c, 0x0e0e0f0a,   0xff,    2,  0}, -	{1,  2140,    4,     8, 0x090a0b0c, 0x0e0f100b,   0xff,    2,  0}, +	{2,  1350, 4, 4,     8, 0x0809090b, 0x0c0c0d0a,   0xff,    2,  0}, +	{2,  1350, 0, 5,     7, 0x0709090b, 0x0c0c0d09,   0xff,    2,  0}, +	{2,  1666, 4, 4,     8, 0x080a0a0d, 0x0d10100b,   0xff,    2,  0}, +	{2,  1666, 0, 5,     7, 0x080a0a0c, 0x0d0d0e0a,   0xff,    2,  0}, +	{2,  1900, 0, 4,     8, 0x090a0b0e, 0x0f11120c,   0xff,    2,  0}, +	{2,  2140, 0, 4,     8, 0x090a0b0e, 0x0f11120c,   0xff,    2,  0}, +	{1,  1350, 0, 5,     8, 0x0809090b, 0x0c0c0d0a,   0xff,    2,  0}, +	{1,  1700, 0, 5,     8, 0x080a0a0c, 0x0c0d0e0a,   0xff,    2,  0}, +	{1,  1900, 0, 4,     8, 0x080a0a0c, 0x0e0e0f0a,   0xff,    2,  0}, +	{1,  2140, 0, 4,     8, 0x090a0b0c, 0x0e0f100b,   0xff,    2,  0},  	{}  }; @@ -61,19 +65,19 @@ static const struct board_specific_parameters *udimms[] = {  static const struct board_specific_parameters rdimm0[] = {  	/*  	 * memory controller 0 -	 *   num|  hi|  clk| wrlvl |   wrlvl   |  wrlvl | cpo  |wrdata|2T -	 * ranks| mhz|adjst| start |   ctl2    |  ctl3  |      |delay | +	 *   num|  hi| rank|  clk| wrlvl |   wrlvl   |  wrlvl | cpo  |wrdata|2T +	 * ranks| mhz| GB  |adjst| start |   ctl2    |  ctl3  |      |delay |  	 */ -	{4,  1350,    5,     9, 0x08070605, 0x07080805,   0xff,    2,  0}, -	{4,  1666,    5,     8, 0x08070605, 0x07080805,   0xff,    2,  0}, -	{4,  2140,    5,     8, 0x08070605, 0x07081805,   0xff,    2,  0}, -	{2,  1350,    5,     7, 0x0809090b, 0x0c0c0d09,   0xff,    2,  0}, -	{2,  1666,    5,     8, 0x080a0a0c, 0x0c0d0e0a,   0xff,    2,  0}, -	{2,  2140,    5,     8, 0x090a0b0c, 0x0e0f100b,   0xff,    2,  0}, -	{1,  1350,    5,     8, 0x0809090b, 0x0c0c0d0a,   0xff,    2,  0}, -	{1,  1700,    5,     8, 0x080a0a0c, 0x0c0d0e0a,   0xff,    2,  0}, -	{1,  1900,    4,     8, 0x080a0a0c, 0x0e0e0f0a,   0xff,    2,  0}, -	{1,  2140,    4,     8, 0x090a0b0c, 0x0e0f100b,   0xff,    2,  0}, +	{4,  1350, 0, 5,     9, 0x08070605, 0x07080805,   0xff,    2,  0}, +	{4,  1666, 0, 5,     8, 0x08070605, 0x07080805,   0xff,    2,  0}, +	{4,  2140, 0, 5,     8, 0x08070605, 0x07081805,   0xff,    2,  0}, +	{2,  1350, 0, 5,     7, 0x0809090b, 0x0c0c0d09,   0xff,    2,  0}, +	{2,  1666, 0, 5,     8, 0x080a0a0c, 0x0c0d0e0a,   0xff,    2,  0}, +	{2,  2140, 0, 5,     8, 0x090a0b0c, 0x0e0f100b,   0xff,    2,  0}, +	{1,  1350, 0, 5,     8, 0x0809090b, 0x0c0c0d0a,   0xff,    2,  0}, +	{1,  1700, 0, 5,     8, 0x080a0a0c, 0x0c0d0e0a,   0xff,    2,  0}, +	{1,  1900, 0, 4,     8, 0x080a0a0c, 0x0e0e0f0a,   0xff,    2,  0}, +	{1,  2140, 0, 4,     8, 0x090a0b0c, 0x0e0f100b,   0xff,    2,  0},  	{}  }; @@ -113,7 +117,8 @@ void fsl_ddr_board_options(memctl_options_t *popts,  	 */  	ddr_freq = get_ddr_freq(0) / 1000000;  	while (pbsp->datarate_mhz_high) { -		if (pbsp->n_ranks == pdimm->n_ranks) { +		if (pbsp->n_ranks == pdimm->n_ranks && +		    (pdimm->rank_density >> 30) >= pbsp->rank_gb) {  			if (ddr_freq <= pbsp->datarate_mhz_high) {  				popts->cpo_override = pbsp->cpo;  				popts->write_data_delay = @@ -146,6 +151,13 @@ void fsl_ddr_board_options(memctl_options_t *popts,  		panic("DIMM is not supported by this board");  	}  found: +	debug("Found timing match: n_ranks %d, data rate %d, rank_gb %d\n" +		"\tclk_adjust %d, wrlvl_start %d, wrlvl_ctrl_2 0x%x, " +		"wrlvl_ctrl_3 0x%x\n", +		pbsp->n_ranks, pbsp->datarate_mhz_high, pbsp->rank_gb, +		pbsp->clk_adjust, pbsp->wrlvl_start, pbsp->wrlvl_ctl_2, +		pbsp->wrlvl_ctl_3); +  	/*  	 * Factors to consider for half-strength driver enable:  	 *	- number of DIMMs installed diff --git a/board/freescale/t4qds/eth.c b/board/freescale/t4qds/eth.c index a49c7d4f1..7103a0d38 100644 --- a/board/freescale/t4qds/eth.c +++ b/board/freescale/t4qds/eth.c @@ -52,7 +52,7 @@  #define EMI1_SLOT4	4  #define EMI1_SLOT5	5  #define EMI1_SLOT7	7 -#define EMI2		8 /* tmp, FIXME */ +#define EMI2		8  /* Slot6 and Slot8 do not have EMI connections */  static int mdio_mux[NUM_FM_PORTS]; @@ -71,6 +71,14 @@ static const char *mdio_names[] = {  static u8 lane_to_slot_fsm1[] = {1, 1, 1, 1, 2, 2, 2, 2};  static u8 lane_to_slot_fsm2[] = {3, 3, 3, 3, 4, 4, 4, 4}; +static u8 slot_qsgmii_phyaddr[5][4] = { +	{0, 0, 0, 0},/* not used, to make index match slot No. */ +	{0, 1, 2, 3}, +	{4, 5, 6, 7}, +	{8, 9, 0xa, 0xb}, +	{0xc, 0xd, 0xe, 0xf}, +}; +static u8 qsgmiiphy_fix[NUM_FM_PORTS] = {0};  static const char *t4240qds_mdio_name_for_muxval(u8 muxval)  { @@ -180,21 +188,228 @@ static int t4240qds_mdio_init(char *realbusname, u8 muxval)  void board_ft_fman_fixup_port(void *blob, char * prop, phys_addr_t pa,  				enum fm_port port, int offset)  { -	if (mdio_mux[port] == EMI1_RGMII) -		fdt_set_phy_handle(blob, prop, pa, "phy_rgmii"); - -	/* TODO: will do with dts */ +	if (fm_info_get_enet_if(port) == PHY_INTERFACE_MODE_SGMII) { +		switch (port) { +		case FM1_DTSEC1: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy21"); +			break; +		case FM1_DTSEC2: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy22"); +			break; +		case FM1_DTSEC3: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy23"); +			break; +		case FM1_DTSEC4: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy24"); +			break; +		case FM1_DTSEC6: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy12"); +			break; +		case FM1_DTSEC9: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy14"); +			else +				fdt_set_phy_handle(blob, prop, pa, +						   "phy_sgmii4"); +			break; +		case FM1_DTSEC10: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy13"); +			else +				fdt_set_phy_handle(blob, prop, pa, +						   "phy_sgmii3"); +			break; +		case FM2_DTSEC1: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy41"); +			break; +		case FM2_DTSEC2: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy42"); +			break; +		case FM2_DTSEC3: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy43"); +			break; +		case FM2_DTSEC4: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy44"); +			break; +		case FM2_DTSEC6: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy32"); +			break; +		case FM2_DTSEC9: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy34"); +			else +				fdt_set_phy_handle(blob, prop, pa, +						   "phy_sgmii12"); +			break; +		case FM2_DTSEC10: +			if (qsgmiiphy_fix[port]) +				fdt_set_phy_handle(blob, prop, pa, +						   "sgmii_phy33"); +			else +				fdt_set_phy_handle(blob, prop, pa, +						   "phy_sgmii11"); +			break; +		default: +			break; +		} +	}  }  void fdt_fixup_board_enet(void *fdt)  { -	/* TODO: will do with dts */ +	int i; +	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +	u32 prtcl2 = in_be32(&gur->rcwsr[4]) & FSL_CORENET2_RCWSR4_SRDS2_PRTCL; + +	prtcl2 >>= FSL_CORENET2_RCWSR4_SRDS2_PRTCL_SHIFT; +	for (i = FM1_DTSEC1; i < NUM_FM_PORTS; i++) { +		switch (fm_info_get_enet_if(i)) { +		case PHY_INTERFACE_MODE_SGMII: +			switch (mdio_mux[i]) { +			case EMI1_SLOT1: +				fdt_status_okay_by_alias(fdt, "emi1_slot1"); +				break; +			case EMI1_SLOT2: +				fdt_status_okay_by_alias(fdt, "emi1_slot2"); +				break; +			case EMI1_SLOT3: +				fdt_status_okay_by_alias(fdt, "emi1_slot3"); +				break; +			case EMI1_SLOT4: +				fdt_status_okay_by_alias(fdt, "emi1_slot4"); +				break; +			default: +				break; +			} +			break; +		case PHY_INTERFACE_MODE_XGMII: +			/* check if it's XFI interface for 10g */ +			if ((prtcl2 == 56) || (prtcl2 == 57)) { +				fdt_status_okay_by_alias(fdt, "emi2_xfislot3"); +				break; +			} +			switch (i) { +			case FM1_10GEC1: +				fdt_status_okay_by_alias(fdt, "emi2_xauislot1"); +				break; +			case FM1_10GEC2: +				fdt_status_okay_by_alias(fdt, "emi2_xauislot2"); +				break; +			case FM2_10GEC1: +				fdt_status_okay_by_alias(fdt, "emi2_xauislot3"); +				break; +			case FM2_10GEC2: +				fdt_status_okay_by_alias(fdt, "emi2_xauislot4"); +				break; +			default: +				break; +			} +			break; +		default: +			break; +		} +	} +} + +static void initialize_qsgmiiphy_fix(void) +{ +	int i; +	unsigned short reg; + +	for (i = 1; i <= 4; i++) { +		/* +		 * Try to read if a SGMII card is used, we do it slot by slot. +		 * if a SGMII PHY address is valid on a slot, then we mark +		 * all ports on the slot, then fix the PHY address for the +		 * marked port when doing dtb fixup. +		 */ +		if (miiphy_read(mdio_names[i], +				SGMII_CARD_PORT1_PHY_ADDR, MII_PHYSID2, ®) != 0) { +			debug("Slot%d PHY ID register 2 read failed\n", i); +			continue; +		} + +		debug("Slot%d MII_PHYSID2 @ 0x1c= 0x%04x\n", i, reg); + +		if (reg == 0xFFFF) { +			/* No physical device present at this address */ +			continue; +		} + +		switch (i) { +		case 1: +			qsgmiiphy_fix[FM1_DTSEC5] = 1; +			qsgmiiphy_fix[FM1_DTSEC6] = 1; +			qsgmiiphy_fix[FM1_DTSEC9] = 1; +			qsgmiiphy_fix[FM1_DTSEC10] = 1; +			slot_qsgmii_phyaddr[1][0] =  SGMII_CARD_PORT1_PHY_ADDR; +			slot_qsgmii_phyaddr[1][1] =  SGMII_CARD_PORT2_PHY_ADDR; +			slot_qsgmii_phyaddr[1][2] =  SGMII_CARD_PORT3_PHY_ADDR; +			slot_qsgmii_phyaddr[1][3] =  SGMII_CARD_PORT4_PHY_ADDR; +			break; +		case 2: +			qsgmiiphy_fix[FM1_DTSEC1] = 1; +			qsgmiiphy_fix[FM1_DTSEC2] = 1; +			qsgmiiphy_fix[FM1_DTSEC3] = 1; +			qsgmiiphy_fix[FM1_DTSEC4] = 1; +			slot_qsgmii_phyaddr[2][0] =  SGMII_CARD_PORT1_PHY_ADDR; +			slot_qsgmii_phyaddr[2][1] =  SGMII_CARD_PORT2_PHY_ADDR; +			slot_qsgmii_phyaddr[2][2] =  SGMII_CARD_PORT3_PHY_ADDR; +			slot_qsgmii_phyaddr[2][3] =  SGMII_CARD_PORT4_PHY_ADDR; +			break; +		case 3: +			qsgmiiphy_fix[FM2_DTSEC5] = 1; +			qsgmiiphy_fix[FM2_DTSEC6] = 1; +			qsgmiiphy_fix[FM2_DTSEC9] = 1; +			qsgmiiphy_fix[FM2_DTSEC10] = 1; +			slot_qsgmii_phyaddr[3][0] =  SGMII_CARD_PORT1_PHY_ADDR; +			slot_qsgmii_phyaddr[3][1] =  SGMII_CARD_PORT2_PHY_ADDR; +			slot_qsgmii_phyaddr[3][2] =  SGMII_CARD_PORT3_PHY_ADDR; +			slot_qsgmii_phyaddr[3][3] =  SGMII_CARD_PORT4_PHY_ADDR; +			break; +		case 4: +			qsgmiiphy_fix[FM2_DTSEC1] = 1; +			qsgmiiphy_fix[FM2_DTSEC2] = 1; +			qsgmiiphy_fix[FM2_DTSEC3] = 1; +			qsgmiiphy_fix[FM2_DTSEC4] = 1; +			slot_qsgmii_phyaddr[4][0] =  SGMII_CARD_PORT1_PHY_ADDR; +			slot_qsgmii_phyaddr[4][1] =  SGMII_CARD_PORT2_PHY_ADDR; +			slot_qsgmii_phyaddr[4][2] =  SGMII_CARD_PORT3_PHY_ADDR; +			slot_qsgmii_phyaddr[4][3] =  SGMII_CARD_PORT4_PHY_ADDR; +			break; +		default: +			break; +		} +	}  }  int board_eth_init(bd_t *bis)  {  #if defined(CONFIG_FMAN_ENET) -	int i; +	int i, idx, lane, slot;  	struct memac_mdio_info dtsec_mdio_info;  	struct memac_mdio_info tgec_mdio_info;  	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); @@ -236,6 +451,7 @@ int board_eth_init(bd_t *bis)  	t4240qds_mdio_init(DEFAULT_FM_MDIO_NAME, EMI1_SLOT7);  	t4240qds_mdio_init(DEFAULT_FM_TGEC_MDIO_NAME, EMI2); +	initialize_qsgmiiphy_fix();  	switch (srds_prtcl_s1) {  	case 1: @@ -248,44 +464,48 @@ int board_eth_init(bd_t *bis)  	case 28:  	case 36:  		/* SGMII in Slot1 and Slot2 */ -		fm_info_set_phy_address(FM1_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC2, SGMII_CARD_PORT2_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC3, SGMII_CARD_PORT3_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC4, SGMII_CARD_PORT4_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); +		fm_info_set_phy_address(FM1_DTSEC1, slot_qsgmii_phyaddr[2][0]); +		fm_info_set_phy_address(FM1_DTSEC2, slot_qsgmii_phyaddr[2][1]); +		fm_info_set_phy_address(FM1_DTSEC3, slot_qsgmii_phyaddr[2][2]); +		fm_info_set_phy_address(FM1_DTSEC4, slot_qsgmii_phyaddr[2][3]); +		fm_info_set_phy_address(FM1_DTSEC5, slot_qsgmii_phyaddr[1][0]); +		fm_info_set_phy_address(FM1_DTSEC6, slot_qsgmii_phyaddr[1][1]);  		if ((srds_prtcl_s2 != 56) && (srds_prtcl_s2 != 57)) {  			fm_info_set_phy_address(FM1_DTSEC9, -						SGMII_CARD_PORT4_PHY_ADDR); +						slot_qsgmii_phyaddr[1][3]);  			fm_info_set_phy_address(FM1_DTSEC10, -						SGMII_CARD_PORT3_PHY_ADDR); +						slot_qsgmii_phyaddr[1][2]);  		}  		break;  	case 38: -		fm_info_set_phy_address(FM1_DTSEC5, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC6, QSGMII_CARD_PHY_ADDR); +		fm_info_set_phy_address(FM1_DTSEC1, slot_qsgmii_phyaddr[2][0]); +		fm_info_set_phy_address(FM1_DTSEC2, slot_qsgmii_phyaddr[2][1]); +		fm_info_set_phy_address(FM1_DTSEC3, slot_qsgmii_phyaddr[2][2]); +		fm_info_set_phy_address(FM1_DTSEC4, slot_qsgmii_phyaddr[2][3]); +		fm_info_set_phy_address(FM1_DTSEC5, slot_qsgmii_phyaddr[1][0]); +		fm_info_set_phy_address(FM1_DTSEC6, slot_qsgmii_phyaddr[1][1]);  		if ((srds_prtcl_s2 != 56) && (srds_prtcl_s2 != 57)) {  			fm_info_set_phy_address(FM1_DTSEC9, -						QSGMII_CARD_PHY_ADDR); +						slot_qsgmii_phyaddr[1][3]);  			fm_info_set_phy_address(FM1_DTSEC10, -						QSGMII_CARD_PHY_ADDR); +						slot_qsgmii_phyaddr[1][2]);  		}  		break;  	case 40:  	case 46:  	case 48: -		fm_info_set_phy_address(FM1_DTSEC5, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); +		fm_info_set_phy_address(FM1_DTSEC5, slot_qsgmii_phyaddr[1][0]); +		fm_info_set_phy_address(FM1_DTSEC6, slot_qsgmii_phyaddr[1][1]);  		if ((srds_prtcl_s2 != 56) && (srds_prtcl_s2 != 57)) {  			fm_info_set_phy_address(FM1_DTSEC10, -						SGMII_CARD_PORT3_PHY_ADDR); +						slot_qsgmii_phyaddr[1][3]);  			fm_info_set_phy_address(FM1_DTSEC9, -						SGMII_CARD_PORT4_PHY_ADDR); +						slot_qsgmii_phyaddr[1][2]);  		} -		fm_info_set_phy_address(FM1_DTSEC1, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC2, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC3, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM1_DTSEC4, QSGMII_CARD_PHY_ADDR); +		fm_info_set_phy_address(FM1_DTSEC1, slot_qsgmii_phyaddr[2][0]); +		fm_info_set_phy_address(FM1_DTSEC2, slot_qsgmii_phyaddr[2][1]); +		fm_info_set_phy_address(FM1_DTSEC3, slot_qsgmii_phyaddr[2][2]); +		fm_info_set_phy_address(FM1_DTSEC4, slot_qsgmii_phyaddr[2][3]);  		break;  	default:  		puts("Invalid SerDes1 protocol for T4240QDS\n"); @@ -293,7 +513,7 @@ int board_eth_init(bd_t *bis)  	}  	for (i = FM1_DTSEC1; i < FM1_DTSEC1 + CONFIG_SYS_NUM_FM1_DTSEC; i++) { -		int idx = i - FM1_DTSEC1, lane, slot; +		idx = i - FM1_DTSEC1;  		switch (fm_info_get_enet_if(i)) {  		case PHY_INTERFACE_MODE_SGMII:  			lane = serdes_get_first_lane(FSL_SRDS_1, @@ -334,8 +554,16 @@ int board_eth_init(bd_t *bis)  	}  	for (i = FM1_10GEC1; i < FM1_10GEC1 + CONFIG_SYS_NUM_FM1_10GEC; i++) { +		idx = i - FM1_10GEC1;  		switch (fm_info_get_enet_if(i)) {  		case PHY_INTERFACE_MODE_XGMII: +			lane = serdes_get_first_lane(FSL_SRDS_1, +						XAUI_FM1_MAC9 + idx); +			if (lane < 0) +				break; +			slot = lane_to_slot_fsm1[lane]; +			if (QIXIS_READ(present2) & (1 << (slot - 1))) +				fm_disable_port(i);  			mdio_mux[i] = EMI2;  			fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));  			break; @@ -344,7 +572,6 @@ int board_eth_init(bd_t *bis)  		}  	} -  #if (CONFIG_SYS_NUM_FMAN == 2)  	switch (srds_prtcl_s2) {  	case 1: @@ -364,68 +591,64 @@ int board_eth_init(bd_t *bis)  	case 26:  		/* XAUI/HiGig in Slot3, SGMII in Slot4 */  		fm_info_set_phy_address(FM2_10GEC1, FM2_10GEC1_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC2, SGMII_CARD_PORT2_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC3, SGMII_CARD_PORT3_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC4, SGMII_CARD_PORT4_PHY_ADDR); +		fm_info_set_phy_address(FM2_DTSEC1, slot_qsgmii_phyaddr[4][0]); +		fm_info_set_phy_address(FM2_DTSEC2, slot_qsgmii_phyaddr[4][1]); +		fm_info_set_phy_address(FM2_DTSEC3, slot_qsgmii_phyaddr[4][2]); +		fm_info_set_phy_address(FM2_DTSEC4, slot_qsgmii_phyaddr[4][3]);  		break;  	case 28:  	case 36:  		/* SGMII in Slot3 and Slot4 */ -		fm_info_set_phy_address(FM2_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC2, SGMII_CARD_PORT2_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC3, SGMII_CARD_PORT3_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC4, SGMII_CARD_PORT4_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC5, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC9, SGMII_CARD_PORT4_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC10, SGMII_CARD_PORT3_PHY_ADDR); +		fm_info_set_phy_address(FM2_DTSEC1, slot_qsgmii_phyaddr[4][0]); +		fm_info_set_phy_address(FM2_DTSEC2, slot_qsgmii_phyaddr[4][1]); +		fm_info_set_phy_address(FM2_DTSEC3, slot_qsgmii_phyaddr[4][2]); +		fm_info_set_phy_address(FM2_DTSEC4, slot_qsgmii_phyaddr[4][3]); +		fm_info_set_phy_address(FM2_DTSEC5, slot_qsgmii_phyaddr[3][0]); +		fm_info_set_phy_address(FM2_DTSEC6, slot_qsgmii_phyaddr[3][1]); +		fm_info_set_phy_address(FM2_DTSEC9, slot_qsgmii_phyaddr[3][3]); +		fm_info_set_phy_address(FM2_DTSEC10, slot_qsgmii_phyaddr[3][2]);  		break;  	case 38:  		/* QSGMII in Slot3 and Slot4 */ -		fm_info_set_phy_address(FM2_DTSEC1, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC2, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC3, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC4, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC5, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC6, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC9, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC10, QSGMII_CARD_PHY_ADDR); +		fm_info_set_phy_address(FM2_DTSEC1, slot_qsgmii_phyaddr[4][0]); +		fm_info_set_phy_address(FM2_DTSEC2, slot_qsgmii_phyaddr[4][1]); +		fm_info_set_phy_address(FM2_DTSEC3, slot_qsgmii_phyaddr[4][2]); +		fm_info_set_phy_address(FM2_DTSEC4, slot_qsgmii_phyaddr[4][3]); +		fm_info_set_phy_address(FM2_DTSEC5, slot_qsgmii_phyaddr[3][0]); +		fm_info_set_phy_address(FM2_DTSEC6, slot_qsgmii_phyaddr[3][1]); +		fm_info_set_phy_address(FM2_DTSEC9, slot_qsgmii_phyaddr[3][3]); +		fm_info_set_phy_address(FM2_DTSEC10, slot_qsgmii_phyaddr[3][2]);  		break;  	case 40:  	case 46:  	case 48:  		/* SGMII in Slot3 */ -		fm_info_set_phy_address(FM2_DTSEC5, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC6, SGMII_CARD_PORT2_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC9, SGMII_CARD_PORT4_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC10, SGMII_CARD_PORT3_PHY_ADDR); +		fm_info_set_phy_address(FM2_DTSEC5, slot_qsgmii_phyaddr[3][0]); +		fm_info_set_phy_address(FM2_DTSEC6, slot_qsgmii_phyaddr[3][1]); +		fm_info_set_phy_address(FM2_DTSEC9, slot_qsgmii_phyaddr[3][3]); +		fm_info_set_phy_address(FM2_DTSEC10, slot_qsgmii_phyaddr[3][2]);  		/* QSGMII in Slot4 */ -		fm_info_set_phy_address(FM2_DTSEC1, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC2, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC3, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC4, QSGMII_CARD_PHY_ADDR); +		fm_info_set_phy_address(FM2_DTSEC1, slot_qsgmii_phyaddr[4][0]); +		fm_info_set_phy_address(FM2_DTSEC2, slot_qsgmii_phyaddr[4][1]); +		fm_info_set_phy_address(FM2_DTSEC3, slot_qsgmii_phyaddr[4][2]); +		fm_info_set_phy_address(FM2_DTSEC4, slot_qsgmii_phyaddr[4][3]);  		break;  	case 50:  	case 52:  	case 54:  		fm_info_set_phy_address(FM2_10GEC1, FM2_10GEC1_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC1, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC2, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC3, QSGMII_CARD_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC4, QSGMII_CARD_PHY_ADDR); +		fm_info_set_phy_address(FM2_DTSEC1, slot_qsgmii_phyaddr[4][0]); +		fm_info_set_phy_address(FM2_DTSEC2, slot_qsgmii_phyaddr[4][1]); +		fm_info_set_phy_address(FM2_DTSEC3, slot_qsgmii_phyaddr[4][2]); +		fm_info_set_phy_address(FM2_DTSEC4, slot_qsgmii_phyaddr[4][3]);  		break;  	case 56:  	case 57:  		/* XFI in Slot3, SGMII in Slot4 */ -		fm_info_set_phy_address(FM1_10GEC1, XFI_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM1_10GEC2, XFI_CARD_PORT2_PHY_ADDR); -		fm_info_set_phy_address(FM2_10GEC2, XFI_CARD_PORT3_PHY_ADDR); -		fm_info_set_phy_address(FM2_10GEC1, XFI_CARD_PORT4_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC1, SGMII_CARD_PORT1_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC2, SGMII_CARD_PORT2_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC3, SGMII_CARD_PORT3_PHY_ADDR); -		fm_info_set_phy_address(FM2_DTSEC4, SGMII_CARD_PORT4_PHY_ADDR); +		fm_info_set_phy_address(FM2_DTSEC1, slot_qsgmii_phyaddr[4][0]); +		fm_info_set_phy_address(FM2_DTSEC2, slot_qsgmii_phyaddr[4][1]); +		fm_info_set_phy_address(FM2_DTSEC3, slot_qsgmii_phyaddr[4][2]); +		fm_info_set_phy_address(FM2_DTSEC4, slot_qsgmii_phyaddr[4][3]);  		break;  	default:  		puts("Invalid SerDes2 protocol for T4240QDS\n"); @@ -433,7 +656,7 @@ int board_eth_init(bd_t *bis)  	}  	for (i = FM2_DTSEC1; i < FM2_DTSEC1 + CONFIG_SYS_NUM_FM2_DTSEC; i++) { -		int idx = i - FM2_DTSEC1, lane, slot; +		idx = i - FM2_DTSEC1;  		switch (fm_info_get_enet_if(i)) {  		case PHY_INTERFACE_MODE_SGMII:  			lane = serdes_get_first_lane(FSL_SRDS_2, @@ -477,8 +700,16 @@ int board_eth_init(bd_t *bis)  	}  	for (i = FM2_10GEC1; i < FM2_10GEC1 + CONFIG_SYS_NUM_FM2_10GEC; i++) { +		idx = i - FM2_10GEC1;  		switch (fm_info_get_enet_if(i)) {  		case PHY_INTERFACE_MODE_XGMII: +			lane = serdes_get_first_lane(FSL_SRDS_2, +						XAUI_FM2_MAC9 + idx); +			if (lane < 0) +				break; +			slot = lane_to_slot_fsm2[lane]; +			if (QIXIS_READ(present2) & (1 << (slot - 1))) +				fm_disable_port(i);  			mdio_mux[i] = EMI2;  			fm_info_set_mdio(i, mii_dev_for_muxval(mdio_mux[i]));  			break; diff --git a/board/freescale/t4qds/law.c b/board/freescale/t4qds/law.c index 6f2c5c86b..f3848f392 100644 --- a/board/freescale/t4qds/law.c +++ b/board/freescale/t4qds/law.c @@ -37,7 +37,8 @@ struct law_entry law_table[] = {  #endif  	SET_LAW(QIXIS_BASE_PHYS, LAW_SIZE_4K, LAW_TRGT_IF_IFC),  #ifdef CONFIG_SYS_DCSRBAR_PHYS -	SET_LAW(CONFIG_SYS_DCSRBAR_PHYS, LAW_SIZE_4M, LAW_TRGT_IF_DCSR), +	/* Limit DCSR to 32M to access NPC Trace Buffer */ +	SET_LAW(CONFIG_SYS_DCSRBAR_PHYS, LAW_SIZE_32M, LAW_TRGT_IF_DCSR),  #endif  #ifdef CONFIG_SYS_NAND_BASE_PHYS  	SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_IFC), diff --git a/board/freescale/t4qds/t4240qds_qixis.h b/board/freescale/t4qds/t4240qds_qixis.h index efb718d2c..485353d5a 100644 --- a/board/freescale/t4qds/t4240qds_qixis.h +++ b/board/freescale/t4qds/t4240qds_qixis.h @@ -42,7 +42,7 @@  #define QIXIS_DDRCLK_125		0x2  #define QIXIS_DDRCLK_133		0x3 -#define BRDCFG5_RESET			0x00 +#define BRDCFG5_IRE			0x20	/* i2c Remote i2c1 enable */  #define BRDCFG12_SD3EN_MASK		0x20  #define BRDCFG12_SD3MX_MASK		0x08 diff --git a/board/freescale/t4qds/t4_pbi.cfg b/board/freescale/t4qds/t4_pbi.cfg new file mode 100644 index 000000000..c598fb5af --- /dev/null +++ b/board/freescale/t4qds/t4_pbi.cfg @@ -0,0 +1,36 @@ +#PBI commands +#Initialize CPC1 +09010000 00200400 +09138000 00000000 +091380c0 00000100 +#512KB SRAM +09010100 00000000 +09010104 fff80009 +09010f00 08000000 +#enable CPC1 +09010000 80000000 +#Configure LAW for CPC1 +09000d00 00000000 +09000d04 fff80000 +09000d08 81000012 +#workaround for IFC bus speed +091241c0 f03f3f3f +091241c4 ff003f3f +09124010 00000101 +09124130 0000000c +#workaround for SERDES A-006031 +090ea000 064740e6 +090ea020 064740e6 +090eb000 064740e6 +090eb020 064740e6 +090ec000 064740e6 +090ec020 064740e6 +090ed000 064740e6 +090ed020 064740e6 +#Configure alternate space +09000010 00000000 +09000014 ff000000 +09000018 81000000 +#Flush PBL data +09138000 00000000 +091380c0 00000000 diff --git a/board/freescale/t4qds/t4_rcw.cfg b/board/freescale/t4qds/t4_rcw.cfg new file mode 100644 index 000000000..6ac95ffd5 --- /dev/null +++ b/board/freescale/t4qds/t4_rcw.cfg @@ -0,0 +1,7 @@ +#PBL preamble and RCW header +aa55aa55 010e0100 +#serdes protocol  1_28_6_12 +14180019 0c101916 00000000 00000000 +04383060 30548c00 6c020000 19000000 +00000000 ee0000ee 00000000 000187fc +00000000 00000000 00000000 00000018 diff --git a/board/freescale/t4qds/t4qds.c b/board/freescale/t4qds/t4qds.c index 3c95f3fb7..f0f280b25 100644 --- a/board/freescale/t4qds/t4qds.c +++ b/board/freescale/t4qds/t4qds.c @@ -110,7 +110,7 @@ int checkboard(void)  	for (i = 0; i < MAX_SERDES; i++) {  		static const char *freq[] = {  			"100", "125", "156.25", "161.1328125"}; -		unsigned int clock = (sw >> (2 * i)) & 3; +		unsigned int clock = (sw >> (6 - 2 * i)) & 3;  		printf("SERDES%u=%sMHz ", i+1, freq[clock]);  	} @@ -132,6 +132,243 @@ int select_i2c_ch_pca9547(u8 ch)  	return 0;  } +/* + * read_voltage from sensor on I2C bus + * We use average of 4 readings, waiting for 532us befor another reading + */ +#define NUM_READINGS	4	/* prefer to be power of 2 for efficiency */ +#define WAIT_FOR_ADC	532	/* wait for 532 microseconds for ADC */ + +static inline int read_voltage(void) +{ +	int i, ret, voltage_read = 0; +	u16 vol_mon; + +	for (i = 0; i < NUM_READINGS; i++) { +		ret = i2c_read(I2C_VOL_MONITOR_ADDR, +			I2C_VOL_MONITOR_BUS_V_OFFSET, 1, (void *)&vol_mon, 2); +		if (ret) { +			printf("VID: failed to read core voltage\n"); +			return ret; +		} +		if (vol_mon & I2C_VOL_MONITOR_BUS_V_OVF) { +			printf("VID: Core voltage sensor error\n"); +			return -1; +		} +		debug("VID: bus voltage reads 0x%04x\n", vol_mon); +		/* LSB = 4mv */ +		voltage_read += (vol_mon >> I2C_VOL_MONITOR_BUS_V_SHIFT) * 4; +		udelay(WAIT_FOR_ADC); +	} +	/* calculate the average */ +	voltage_read /= NUM_READINGS; + +	return voltage_read; +} + +/* + * We need to calculate how long before the voltage starts to drop or increase + * It returns with the loop count. Each loop takes several readings (532us) + */ +static inline int wait_for_voltage_change(int vdd_last) +{ +	int timeout, vdd_current; + +	vdd_current = read_voltage(); +	/* wait until voltage starts to drop */ +	for (timeout = 0; abs(vdd_last - vdd_current) <= 4 && +		timeout < 100; timeout++) { +		vdd_current = read_voltage(); +	} +	if (timeout >= 100) { +		printf("VID: Voltage adjustment timeout\n"); +		return -1; +	} +	return timeout; +} + +/* + * argument 'wait' is the time we know the voltage difference can be measured + * this function keeps reading the voltage until it is stable + */ +static inline int wait_for_voltage_stable(int wait) +{ +	int timeout, vdd_current, vdd_last; + +	vdd_last = read_voltage(); +	udelay(wait * NUM_READINGS * WAIT_FOR_ADC); +	/* wait until voltage is stable */ +	vdd_current = read_voltage(); +	for (timeout = 0; abs(vdd_last - vdd_current) >= 4 && +		timeout < 100; timeout++) { +		vdd_last = vdd_current; +		udelay(wait * NUM_READINGS * WAIT_FOR_ADC); +		vdd_current = read_voltage(); +	} +	if (timeout >= 100) { +		printf("VID: Voltage adjustment timeout\n"); +		return -1; +	} + +	return vdd_current; +} + +static inline int set_voltage(u8 vid) +{ +	int wait, vdd_last; + +	vdd_last = read_voltage(); +	QIXIS_WRITE(brdcfg[6], vid); +	wait = wait_for_voltage_change(vdd_last); +	if (wait < 0) +		return -1; +	debug("VID: Waited %d us\n", wait * NUM_READINGS * WAIT_FOR_ADC); +	wait = wait ? wait : 1; + +	vdd_last = wait_for_voltage_stable(wait); +	if (vdd_last < 0) +		return -1; +	debug("VID: Current voltage is %d mV\n", vdd_last); + +	return vdd_last; +} + + +static int adjust_vdd(ulong vdd_override) +{ +	int re_enable = disable_interrupts(); +	ccsr_gur_t __iomem *gur = +		(void __iomem *)(CONFIG_SYS_MPC85xx_GUTS_ADDR); +	u32 fusesr; +	u8 vid, vid_current; +	int vdd_target, vdd_current, vdd_last; +	int ret; +	unsigned long vdd_string_override; +	char *vdd_string; +	static const uint16_t vdd[32] = { +		0,	/* unused */ +		9875,	/* 0.9875V */ +		9750, +		9625, +		9500, +		9375, +		9250, +		9125, +		9000, +		8875, +		8750, +		8625, +		8500, +		8375, +		8250, +		8125, +		10000,	/* 1.0000V */ +		10125, +		10250, +		10375, +		10500, +		10625, +		10750, +		10875, +		11000, +		0,	/* reserved */ +	}; +	struct vdd_drive { +		u8 vid; +		unsigned voltage; +	}; + +	ret = select_i2c_ch_pca9547(I2C_MUX_CH_VOL_MONITOR); +	if (ret) { +		debug("VID: I2c failed to switch channel\n"); +		ret = -1; +		goto exit; +	} + +	/* get the voltage ID from fuse status register */ +	fusesr = in_be32(&gur->dcfg_fusesr); +	vid = (fusesr >> FSL_CORENET_DCFG_FUSESR_VID_SHIFT) & +		FSL_CORENET_DCFG_FUSESR_VID_MASK; +	if (vid == FSL_CORENET_DCFG_FUSESR_VID_MASK) { +		vid = (fusesr >> FSL_CORENET_DCFG_FUSESR_ALTVID_SHIFT) & +			FSL_CORENET_DCFG_FUSESR_ALTVID_MASK; +	} +	vdd_target = vdd[vid]; + +	/* check override variable for overriding VDD */ +	vdd_string = getenv("t4240qds_vdd_mv"); +	if (vdd_override == 0 && vdd_string && +	    !strict_strtoul(vdd_string, 10, &vdd_string_override)) +		vdd_override = vdd_string_override; +	if (vdd_override >= 819 && vdd_override <= 1212) { +		vdd_target = vdd_override * 10; /* convert to 1/10 mV */ +		debug("VDD override is %lu\n", vdd_override); +	} else if (vdd_override != 0) { +		printf("Invalid value.\n"); +	} + +	if (vdd_target == 0) { +		debug("VID: VID not used\n"); +		ret = 0; +		goto exit; +	} else { +		/* round up and divice by 10 to get a value in mV */ +		vdd_target = DIV_ROUND_UP(vdd_target, 10); +		debug("VID: vid = %d mV\n", vdd_target); +	} + +	/* +	 * Check current board VID setting +	 * Voltage regulator support output to 6.250mv step +	 * The highes voltage allowed for this board is (vid=0x40) 1.21250V +	 * the lowest is (vid=0x7f) 0.81875V +	 */ +	vid_current =  QIXIS_READ(brdcfg[6]); +	vdd_current = 121250 - (vid_current - 0x40) * 625; +	debug("VID: Current vid setting is (0x%x) %d mV\n", +	      vid_current, vdd_current/100); + +	/* +	 * Read voltage monitor to check real voltage. +	 * Voltage monitor LSB is 4mv. +	 */ +	vdd_last = read_voltage(); +	if (vdd_last < 0) { +		printf("VID: Could not read voltage sensor abort VID adjustment\n"); +		ret = -1; +		goto exit; +	} +	debug("VID: Core voltage is at %d mV\n", vdd_last); +	/* +	 * Adjust voltage to at or 8mV above target. +	 * Each step of adjustment is 6.25mV. +	 * Stepping down too fast may cause over current. +	 */ +	while (vdd_last > 0 && vid_current < 0x80 && +		vdd_last > (vdd_target + 8)) { +		vid_current++; +		vdd_last = set_voltage(vid_current); +	} +	/* +	 * Check if we need to step up +	 * This happens when board voltage switch was set too low +	 */ +	while (vdd_last > 0 && vid_current >= 0x40 && +		vdd_last < vdd_target + 2) { +		vid_current--; +		vdd_last = set_voltage(vid_current); +	} +	if (vdd_last > 0) +		printf("VID: Core voltage %d mV\n", vdd_last); +	else +		ret = -1; + +exit: +	if (re_enable) +		enable_interrupts(); +	return ret; +} +  /* Configure Crossbar switches for Front-Side SerDes Ports */  int config_frontside_crossbar_vsc3316(void)  { @@ -282,8 +519,15 @@ int board_early_init_r(void)  	setup_portals();  #endif -	/* Disable remote I2C connectoin */ -	QIXIS_WRITE(brdcfg[5], BRDCFG5_RESET); +	/* Disable remote I2C connection to qixis fpga */ +	QIXIS_WRITE(brdcfg[5], QIXIS_READ(brdcfg[5]) & ~BRDCFG5_IRE); + +	/* +	 * Adjust core voltage according to voltage ID +	 * This function changes I2C mux to channel 2. +	 */ +	if (adjust_vdd(0)) +		printf("Warning: Adjusting core voltage failed.\n");  	/* Configure board SERDES ports crossbar */  	config_frontside_crossbar_vsc3316(); @@ -296,6 +540,20 @@ int board_early_init_r(void)  unsigned long get_board_sys_clk(void)  {  	u8 sysclk_conf = QIXIS_READ(brdcfg[1]); +#ifdef CONFIG_FSL_QIXIS_CLOCK_MEASUREMENT +	/* use accurate clock measurement */ +	int freq = QIXIS_READ(clk_freq[0]) << 8 | QIXIS_READ(clk_freq[1]); +	int base = QIXIS_READ(clk_base[0]) << 8 | QIXIS_READ(clk_base[1]); +	u32 val; + +	val =  freq * base; +	if (val) { +		debug("SYS Clock measurement is: %d\n", val); +		return val; +	} else { +		printf("Warning: SYS clock measurement is invalid, using value from brdcfg1.\n"); +	} +#endif  	switch (sysclk_conf & 0x0F) {  	case QIXIS_SYSCLK_83: @@ -319,6 +577,20 @@ unsigned long get_board_sys_clk(void)  unsigned long get_board_ddr_clk(void)  {  	u8 ddrclk_conf = QIXIS_READ(brdcfg[1]); +#ifdef CONFIG_FSL_QIXIS_CLOCK_MEASUREMENT +	/* use accurate clock measurement */ +	int freq = QIXIS_READ(clk_freq[2]) << 8 | QIXIS_READ(clk_freq[3]); +	int base = QIXIS_READ(clk_base[0]) << 8 | QIXIS_READ(clk_base[1]); +	u32 val; + +	val =  freq * base; +	if (val) { +		debug("DDR Clock measurement is: %d\n", val); +		return val; +	} else { +		printf("Warning: DDR clock measurement is invalid, using value from brdcfg1.\n"); +	} +#endif  	switch ((ddrclk_conf & 0x30) >> 4) {  	case QIXIS_DDRCLK_100: @@ -357,7 +629,7 @@ int misc_init_r(void)  	sw = QIXIS_READ(brdcfg[2]);  	for (i = 0; i < MAX_SERDES; i++) { -		unsigned int clock = (sw >> (2 * i)) & 3; +		unsigned int clock = (sw >> (6 - 2 * i)) & 3;  		switch (clock) {  		case 0:  			actual[i] = SRDS_PLLCR0_RFCK_SEL_100; @@ -414,6 +686,106 @@ void ft_board_setup(void *blob, bd_t *bd)  }  /* + * This function is called by bdinfo to print detail board information. + * As an exmaple for future board, we organize the messages into + * several sections. If applicable, the message is in the format of + * <name>      = <value> + * It should aligned with normal output of bdinfo command. + * + * Voltage: Core, DDR and another configurable voltages + * Clock  : Critical clocks which are not printed already + * RCW    : RCW source if not printed already + * Misc   : Other important information not in above catagories + */ +void board_detail(void) +{ +	int i; +	u8 brdcfg[16], dutcfg[16], rst_ctl; +	int vdd, rcwsrc; +	static const char * const clk[] = {"66.67", "100", "125", "133.33"}; + +	for (i = 0; i < 16; i++) { +		brdcfg[i] = qixis_read(offsetof(struct qixis, brdcfg[0]) + i); +		dutcfg[i] = qixis_read(offsetof(struct qixis, dutcfg[0]) + i); +	} + +	/* Voltage secion */ +	if (!select_i2c_ch_pca9547(I2C_MUX_CH_VOL_MONITOR)) { +		vdd = read_voltage(); +		if (vdd > 0) +			printf("Core voltage= %d mV\n", vdd); +		select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT); +	} + +	printf("XVDD        = 1.%d V\n", ((brdcfg[8] & 0xf) - 4) * 5 + 25); + +	/* clock section */ +	printf("SYSCLK      = %s MHz\nDDRCLK      = %s MHz\n", +	       clk[(brdcfg[11] >> 2) & 0x3], clk[brdcfg[11] & 3]); + +	/* RCW section */ +	rcwsrc = (dutcfg[0] << 1) + (dutcfg[1] & 1); +	puts("RCW source  = "); +	switch (rcwsrc) { +	case 0x017: +	case 0x01f: +		puts("8-bit NOR\n"); +		break; +	case 0x027: +	case 0x02F: +		puts("16-bit NOR\n"); +		break; +	case 0x040: +		puts("SDHC/eMMC\n"); +		break; +	case 0x044: +		puts("SPI 16-bit addressing\n"); +		break; +	case 0x045: +		puts("SPI 24-bit addressing\n"); +		break; +	case 0x048: +		puts("I2C normal addressing\n"); +		break; +	case 0x049: +		puts("I2C extended addressing\n"); +		break; +	case 0x108: +	case 0x109: +	case 0x10a: +	case 0x10b: +		puts("8-bit NAND, 2KB\n"); +		break; +	default: +		if ((rcwsrc >= 0x080) && (rcwsrc <= 0x09f)) +			puts("Hard-coded RCW\n"); +		else if ((rcwsrc >= 0x110) && (rcwsrc <= 0x11f)) +			puts("8-bit NAND, 4KB\n"); +		else +			puts("unknown\n"); +		break; +	} + +	/* Misc section */ +	rst_ctl = QIXIS_READ(rst_ctl); +	puts("HRESET_REQ  = "); +	switch (rst_ctl & 0x30) { +	case 0x00: +		puts("Ignored\n"); +		break; +	case 0x10: +		puts("Assert HRESET\n"); +		break; +	case 0x30: +		puts("Reset system\n"); +		break; +	default: +		puts("N/A\n"); +		break; +	} +} + +/*   * Reverse engineering switch settings.   * Some bits cannot be figured out. They will be displayed as   * underscore in binary format. mask[] has those bits. @@ -429,7 +801,7 @@ void qixis_dump_switch(void)  	 * Any bit with 1 means that bit cannot be reverse engineered.  	 * It will be displayed as _ in binary format.  	 */ -	static const u8 mask[] = {0, 0, 0, 0, 0, 0x1, 0xdf, 0x3f, 0x1f}; +	static const u8 mask[] = {0, 0, 0, 0, 0, 0x1, 0xcf, 0x3f, 0x1f};  	char buf[10];  	u8 brdcfg[16], dutcfg[16]; @@ -460,7 +832,8 @@ void qixis_dump_switch(void)  	sw[5] = ((brdcfg[0] & 0x0f) << 4)	| \  		((QIXIS_READ(rst_ctl) & 0x30) >> 2) | \  		((brdcfg[0] & 0x40) >> 5); -	sw[6] = (brdcfg[11] & 0x20); +	sw[6] = (brdcfg[11] & 0x20)		| +		((brdcfg[5] & 0x02) << 3);  	sw[7] = (((~QIXIS_READ(rst_ctl)) & 0x40) << 1) | \  		((brdcfg[5] & 0x10) << 2);  	sw[8] = ((brdcfg[12] & 0x08) << 4)	| \ @@ -472,3 +845,23 @@ void qixis_dump_switch(void)  			i + 1, byte_to_binary_mask(sw[i], mask[i], buf), sw[i]);  	}  } + +static int do_vdd_adjust(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +{ +	ulong override; + +	if (argc < 2) +		return CMD_RET_USAGE; +	if (!strict_strtoul(argv[1], 10, &override)) +		adjust_vdd(override);	/* the value is checked by callee */ +	else +		return CMD_RET_USAGE; + +	return 0; +} + +U_BOOT_CMD( +	vdd_override, 2, 0, do_vdd_adjust, +	"Override VDD", +	"- override with the voltage specified in mV, eg. 1050" +); diff --git a/board/freescale/t4qds/tlb.c b/board/freescale/t4qds/tlb.c index 80eb511e1..92c01cf95 100644 --- a/board/freescale/t4qds/tlb.c +++ b/board/freescale/t4qds/tlb.c @@ -115,7 +115,7 @@ struct fsl_e_tlb_entry tlb_table[] = {  #ifdef CONFIG_SYS_DCSRBAR_PHYS  	SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,  		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G, -		      0, 13, BOOKE_PAGESZ_4M, 1), +		      0, 13, BOOKE_PAGESZ_32M, 1),  #endif  #ifdef CONFIG_SYS_NAND_BASE  	/* diff --git a/board/sorcery/Makefile b/board/freescale/vf610twr/Makefile index e1752e3fa..74162281a 100644 --- a/board/sorcery/Makefile +++ b/board/freescale/vf610twr/Makefile @@ -1,9 +1,5 @@  # -# (C) Copyright 2005-2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. +# Copyright 2013 Freescale Semiconductor, Inc.  #  # This program is free software; you can redistribute it and/or  # modify it under the terms of the GNU General Public License as @@ -27,11 +23,10 @@ LIB	= $(obj)lib$(BOARD).o  COBJS	:= $(BOARD).o -SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) +SRCS	:= $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) -SOBJS	:= $(addprefix $(obj),$(SOBJS)) -$(LIB):	$(OBJS) +$(LIB):	$(obj).depend $(OBJS)  	$(call cmd_link_o_target, $(OBJS))  ######################################################################### diff --git a/board/freescale/vf610twr/imximage.cfg b/board/freescale/vf610twr/imximage.cfg new file mode 100644 index 000000000..b00d4c1cd --- /dev/null +++ b/board/freescale/vf610twr/imximage.cfg @@ -0,0 +1,33 @@ +/* + * Copyright 2013 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. 51 Franklin Street Fifth Floor Boston, + * MA 02110-1301 USA + * + * Refer docs/README.imxmage for more details about how-to configure + * and create imximage boot image + * + * The syntax is taken as close as possible with the kwbimage + */ +#include <asm/imx-common/imximage.cfg> + +/* image version */ +IMAGE_VERSION	2 + +/* Boot Offset 0x400, valid for both SD and NAND boot */ +BOOT_OFFSET	FLASH_OFFSET_STANDARD diff --git a/board/freescale/vf610twr/vf610twr.c b/board/freescale/vf610twr/vf610twr.c new file mode 100644 index 000000000..f14df8b6e --- /dev/null +++ b/board/freescale/vf610twr/vf610twr.c @@ -0,0 +1,407 @@ +/* + * Copyright 2013 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * 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/arch/imx-regs.h> +#include <asm/arch/iomux-vf610.h> +#include <asm/arch/crm_regs.h> +#include <asm/arch/clock.h> +#include <mmc.h> +#include <fsl_esdhc.h> +#include <miiphy.h> +#include <netdev.h> + +DECLARE_GLOBAL_DATA_PTR; + +#define UART_PAD_CTRL	(PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \ +			PAD_CTL_DSE_25ohm | PAD_CTL_OBE_IBE_ENABLE) + +#define ESDHC_PAD_CTRL	(PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_HIGH | \ +			PAD_CTL_DSE_20ohm | PAD_CTL_OBE_IBE_ENABLE) + +#define ENET_PAD_CTRL	(PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH | \ +			PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE) + +void setup_iomux_ddr(void) +{ +	static const iomux_v3_cfg_t ddr_pads[] = { +		VF610_PAD_DDR_A15__DDR_A_15, +		VF610_PAD_DDR_A15__DDR_A_15, +		VF610_PAD_DDR_A14__DDR_A_14, +		VF610_PAD_DDR_A13__DDR_A_13, +		VF610_PAD_DDR_A12__DDR_A_12, +		VF610_PAD_DDR_A11__DDR_A_11, +		VF610_PAD_DDR_A10__DDR_A_10, +		VF610_PAD_DDR_A9__DDR_A_9, +		VF610_PAD_DDR_A8__DDR_A_8, +		VF610_PAD_DDR_A7__DDR_A_7, +		VF610_PAD_DDR_A6__DDR_A_6, +		VF610_PAD_DDR_A5__DDR_A_5, +		VF610_PAD_DDR_A4__DDR_A_4, +		VF610_PAD_DDR_A3__DDR_A_3, +		VF610_PAD_DDR_A2__DDR_A_2, +		VF610_PAD_DDR_A1__DDR_A_1, +		VF610_PAD_DDR_BA2__DDR_BA_2, +		VF610_PAD_DDR_BA1__DDR_BA_1, +		VF610_PAD_DDR_BA0__DDR_BA_0, +		VF610_PAD_DDR_CAS__DDR_CAS_B, +		VF610_PAD_DDR_CKE__DDR_CKE_0, +		VF610_PAD_DDR_CLK__DDR_CLK_0, +		VF610_PAD_DDR_CS__DDR_CS_B_0, +		VF610_PAD_DDR_D15__DDR_D_15, +		VF610_PAD_DDR_D14__DDR_D_14, +		VF610_PAD_DDR_D13__DDR_D_13, +		VF610_PAD_DDR_D12__DDR_D_12, +		VF610_PAD_DDR_D11__DDR_D_11, +		VF610_PAD_DDR_D10__DDR_D_10, +		VF610_PAD_DDR_D9__DDR_D_9, +		VF610_PAD_DDR_D8__DDR_D_8, +		VF610_PAD_DDR_D7__DDR_D_7, +		VF610_PAD_DDR_D6__DDR_D_6, +		VF610_PAD_DDR_D5__DDR_D_5, +		VF610_PAD_DDR_D4__DDR_D_4, +		VF610_PAD_DDR_D3__DDR_D_3, +		VF610_PAD_DDR_D2__DDR_D_2, +		VF610_PAD_DDR_D1__DDR_D_1, +		VF610_PAD_DDR_D0__DDR_D_0, +		VF610_PAD_DDR_DQM1__DDR_DQM_1, +		VF610_PAD_DDR_DQM0__DDR_DQM_0, +		VF610_PAD_DDR_DQS1__DDR_DQS_1, +		VF610_PAD_DDR_DQS0__DDR_DQS_0, +		VF610_PAD_DDR_RAS__DDR_RAS_B, +		VF610_PAD_DDR_WE__DDR_WE_B, +		VF610_PAD_DDR_ODT1__DDR_ODT_0, +		VF610_PAD_DDR_ODT0__DDR_ODT_1, +	}; + +	imx_iomux_v3_setup_multiple_pads(ddr_pads, ARRAY_SIZE(ddr_pads)); +} + +void ddr_phy_init(void) +{ +	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR; + +	writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[0]); +	writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[16]); +	writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[32]); +	writel(DDRMC_PHY_DQ_TIMING, &ddrmr->phy[48]); + +	writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[1]); +	writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[17]); +	writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[33]); +	writel(DDRMC_PHY_DQS_TIMING, &ddrmr->phy[49]); + +	writel(DDRMC_PHY_CTRL, &ddrmr->phy[2]); +	writel(DDRMC_PHY_CTRL, &ddrmr->phy[18]); +	writel(DDRMC_PHY_CTRL, &ddrmr->phy[34]); +	writel(DDRMC_PHY_CTRL, &ddrmr->phy[50]); + +	writel(DDRMC_PHY_MASTER_CTRL, &ddrmr->phy[3]); +	writel(DDRMC_PHY_MASTER_CTRL, &ddrmr->phy[19]); +	writel(DDRMC_PHY_MASTER_CTRL, &ddrmr->phy[35]); +	writel(DDRMC_PHY_MASTER_CTRL, &ddrmr->phy[51]); + +	writel(DDRMC_PHY_SLAVE_CTRL, &ddrmr->phy[4]); +	writel(DDRMC_PHY_SLAVE_CTRL, &ddrmr->phy[20]); +	writel(DDRMC_PHY_SLAVE_CTRL, &ddrmr->phy[36]); +	writel(DDRMC_PHY_SLAVE_CTRL, &ddrmr->phy[52]); + +	writel(DDRMC_PHY50_DDR3_MODE | DDRMC_PHY50_EN_SW_HALF_CYCLE, +		&ddrmr->phy[50]); +} + +void ddr_ctrl_init(void) +{ +	struct ddrmr_regs *ddrmr = (struct ddrmr_regs *)DDR_BASE_ADDR; + +	writel(DDRMC_CR00_DRAM_CLASS_DDR3, &ddrmr->cr[0]); +	writel(DDRMC_CR02_DRAM_TINIT(32), &ddrmr->cr[2]); +	writel(DDRMC_CR10_TRST_PWRON(124), &ddrmr->cr[10]); + +	writel(DDRMC_CR11_CKE_INACTIVE(80000), &ddrmr->cr[11]); +	writel(DDRMC_CR12_WRLAT(5) | DDRMC_CR12_CASLAT_LIN(12), &ddrmr->cr[12]); +	writel(DDRMC_CR13_TRC(21) | DDRMC_CR13_TRRD(4) | DDRMC_CR13_TCCD(4) | +		DDRMC_CR13_TBST_INT_INTERVAL(4), &ddrmr->cr[13]); +	writel(DDRMC_CR14_TFAW(20) | DDRMC_CR14_TRP(6) | DDRMC_CR14_TWTR(4) | +		DDRMC_CR14_TRAS_MIN(15), &ddrmr->cr[14]); +	writel(DDRMC_CR16_TMRD(4) | DDRMC_CR16_TRTP(4), &ddrmr->cr[16]); +	writel(DDRMC_CR17_TRAS_MAX(28080) | DDRMC_CR17_TMOD(12), +		&ddrmr->cr[17]); +	writel(DDRMC_CR18_TCKESR(4) | DDRMC_CR18_TCKE(3), &ddrmr->cr[18]); + +	writel(DDRMC_CR20_AP_EN, &ddrmr->cr[20]); +	writel(DDRMC_CR21_TRCD_INT(6) | DDRMC_CR21_TRAS_LOCKOUT | +		DDRMC_CR21_CCMAP_EN, &ddrmr->cr[21]); + +	writel(DDRMC_CR22_TDAL(11), &ddrmr->cr[22]); +	writel(DDRMC_CR23_BSTLEN(3) | DDRMC_CR23_TDLL(512), &ddrmr->cr[23]); +	writel(DDRMC_CR24_TRP_AB(6), &ddrmr->cr[24]); + +	writel(DDRMC_CR25_TREF_EN, &ddrmr->cr[25]); +	writel(DDRMC_CR26_TREF(3112) | DDRMC_CR26_TRFC(44), &ddrmr->cr[26]); +	writel(DDRMC_CR28_TREF_INT(5), &ddrmr->cr[28]); +	writel(DDRMC_CR29_TPDEX(3), &ddrmr->cr[29]); + +	writel(DDRMC_CR30_TXPDLL(10), &ddrmr->cr[30]); +	writel(DDRMC_CR31_TXSNR(68) | DDRMC_CR31_TXSR(512), &ddrmr->cr[31]); +	writel(DDRMC_CR33_EN_QK_SREF, &ddrmr->cr[33]); +	writel(DDRMC_CR34_CKSRX(5) | DDRMC_CR34_CKSRE(5), &ddrmr->cr[34]); + +	writel(DDRMC_CR38_FREQ_CHG_EN, &ddrmr->cr[38]); +	writel(DDRMC_CR39_PHY_INI_COM(1024) | DDRMC_CR39_PHY_INI_STA(16) | +		DDRMC_CR39_FRQ_CH_DLLOFF(2), &ddrmr->cr[39]); + +	writel(DDRMC_CR41_PHY_INI_STRT_INI_DIS, &ddrmr->cr[41]); +	writel(DDRMC_CR48_MR1_DA_0(70) | DDRMC_CR48_MR0_DA_0(1056), +		&ddrmr->cr[48]); + +	writel(DDRMC_CR66_ZQCL(256) | DDRMC_CR66_ZQINIT(512), &ddrmr->cr[66]); +	writel(DDRMC_CR67_ZQCS(64), &ddrmr->cr[67]); +	writel(DDRMC_CR69_ZQ_ON_SREF_EX(2), &ddrmr->cr[69]); + +	writel(DDRMC_CR70_REF_PER_ZQ(64), &ddrmr->cr[70]); +	writel(DDRMC_CR72_ZQCS_ROTATE, &ddrmr->cr[72]); + +	writel(DDRMC_CR73_APREBIT(10) | DDRMC_CR73_COL_DIFF(1) | +		DDRMC_CR73_ROW_DIFF(3), &ddrmr->cr[73]); +	writel(DDRMC_CR74_BANKSPLT_EN | DDRMC_CR74_ADDR_CMP_EN | +		DDRMC_CR74_CMD_AGE_CNT(255) | DDRMC_CR74_AGE_CNT(255), +		&ddrmr->cr[74]); +	writel(DDRMC_CR75_RW_PG_EN | DDRMC_CR75_RW_EN | DDRMC_CR75_PRI_EN | +		DDRMC_CR75_PLEN, &ddrmr->cr[75]); +	writel(DDRMC_CR76_NQENT_ACTDIS(3) | DDRMC_CR76_D_RW_G_BKCN(3) | +		DDRMC_CR76_W2R_SPLT_EN | DDRMC_CR76_CS_EN, &ddrmr->cr[76]); +	writel(DDRMC_CR77_CS_MAP | DDRMC_CR77_DI_RD_INTLEAVE | +		DDRMC_CR77_SWAP_EN, &ddrmr->cr[77]); +	writel(DDRMC_CR78_BUR_ON_FLY_BIT(12), &ddrmr->cr[78]); +	writel(DDRMC_CR79_CTLUPD_AREF, &ddrmr->cr[79]); + +	writel(DDRMC_CR82_INT_MASK, &ddrmr->cr[82]); + +	writel(DDRMC_CR87_ODT_WR_MAPCS0 | DDRMC_CR87_ODT_RD_MAPCS0, +		&ddrmr->cr[87]); +	writel(DDRMC_CR88_TODTL_CMD(4), &ddrmr->cr[88]); +	writel(DDRMC_CR89_AODT_RWSMCS(2), &ddrmr->cr[89]); + +	writel(DDRMC_CR91_R2W_SMCSDL(2), &ddrmr->cr[91]); +	writel(DDRMC_CR96_WLMRD(40) | DDRMC_CR96_WLDQSEN(25), &ddrmr->cr[96]); + +	writel(DDRMC_CR105_RDLVL_DL_0(32), &ddrmr->cr[105]); +	writel(DDRMC_CR110_RDLVL_DL_1(32), &ddrmr->cr[110]); +	writel(DDRMC_CR114_RDLVL_GTDL_2(8224), &ddrmr->cr[114]); + +	writel(DDRMC_CR117_AXI0_W_PRI(1) | DDRMC_CR117_AXI0_R_PRI(1), +		&ddrmr->cr[117]); +	writel(DDRMC_CR118_AXI1_W_PRI(1) | DDRMC_CR118_AXI1_R_PRI(1), +		&ddrmr->cr[118]); + +	writel(DDRMC_CR120_AXI0_PRI1_RPRI(2) | DDRMC_CR120_AXI0_PRI0_RPRI(2), +		&ddrmr->cr[120]); +	writel(DDRMC_CR121_AXI0_PRI3_RPRI(2) | DDRMC_CR121_AXI0_PRI2_RPRI(2), +		&ddrmr->cr[121]); +	writel(DDRMC_CR122_AXI1_PRI1_RPRI(1) | DDRMC_CR122_AXI1_PRI0_RPRI(1) | +		DDRMC_CR122_AXI0_PRIRLX(100), &ddrmr->cr[122]); +	writel(DDRMC_CR123_AXI1_PRI3_RPRI(1) | DDRMC_CR123_AXI1_PRI2_RPRI(1), +		&ddrmr->cr[123]); +	writel(DDRMC_CR124_AXI1_PRIRLX(100), &ddrmr->cr[124]); + +	writel(DDRMC_CR126_PHY_RDLAT(11), &ddrmr->cr[126]); +	writel(DDRMC_CR132_WRLAT_ADJ(5) | DDRMC_CR132_RDLAT_ADJ(6), +		&ddrmr->cr[132]); +	writel(DDRMC_CR139_PHY_WRLV_RESPLAT(4) | DDRMC_CR139_PHY_WRLV_LOAD(7) | +		DDRMC_CR139_PHY_WRLV_DLL(3) | DDRMC_CR139_PHY_WRLV_EN(3), +		&ddrmr->cr[139]); + +	writel(DDRMC_CR154_PAD_ZQ_EARLY_CMP_EN_TIMER(13) | +		DDRMC_CR154_PAD_ZQ_MODE(1), &ddrmr->cr[154]); +	writel(DDRMC_CR155_AXI0_AWCACHE | DDRMC_CR155_PAD_ODT_BYTE1(2), +		&ddrmr->cr[155]); +	writel(DDRMC_CR158_TWR(6), &ddrmr->cr[158]); + +	ddr_phy_init(); + +	writel(DDRMC_CR00_DRAM_CLASS_DDR3 | DDRMC_CR00_START, &ddrmr->cr[0]); + +	udelay(200); +} + +int dram_init(void) +{ +	setup_iomux_ddr(); + +	ddr_ctrl_init(); +	gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE); + +	return 0; +} + +static void setup_iomux_uart(void) +{ +	static const iomux_v3_cfg_t uart1_pads[] = { +		NEW_PAD_CTRL(VF610_PAD_PTB4__UART1_TX, UART_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTB5__UART1_RX, UART_PAD_CTRL), +	}; + +	imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads)); +} + +static void setup_iomux_enet(void) +{ +	static const iomux_v3_cfg_t enet0_pads[] = { +		NEW_PAD_CTRL(VF610_PAD_PTA6__RMII0_CLKIN, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC1__RMII0_MDIO, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC0__RMII0_MDC, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC2__RMII0_CRS_DV, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC3__RMII0_RD1, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC4__RMII0_RD0, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC5__RMII0_RXER, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC6__RMII0_TD1, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC7__RMII0_TD0, ENET_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTC8__RMII0_TXEN, ENET_PAD_CTRL), +	}; + +	imx_iomux_v3_setup_multiple_pads(enet0_pads, ARRAY_SIZE(enet0_pads)); +} + +#ifdef CONFIG_FSL_ESDHC +struct fsl_esdhc_cfg esdhc_cfg[1] = { +	{ESDHC1_BASE_ADDR}, +}; + +int board_mmc_getcd(struct mmc *mmc) +{ +	/* eSDHC1 is always present */ +	return 1; +} + +int board_mmc_init(bd_t *bis) +{ +	static const iomux_v3_cfg_t esdhc1_pads[] = { +		NEW_PAD_CTRL(VF610_PAD_PTA24__ESDHC1_CLK, ESDHC_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTA25__ESDHC1_CMD, ESDHC_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTA26__ESDHC1_DAT0, ESDHC_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTA27__ESDHC1_DAT1, ESDHC_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTA28__ESDHC1_DAT2, ESDHC_PAD_CTRL), +		NEW_PAD_CTRL(VF610_PAD_PTA29__ESDHC1_DAT3, ESDHC_PAD_CTRL), +	}; + +	esdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); + +	imx_iomux_v3_setup_multiple_pads( +		esdhc1_pads, ARRAY_SIZE(esdhc1_pads)); + +	return fsl_esdhc_initialize(bis, &esdhc_cfg[0]); +} +#endif + +static void clock_init(void) +{ +	struct ccm_reg *ccm = (struct ccm_reg *)CCM_BASE_ADDR; +	struct anadig_reg *anadig = (struct anadig_reg *)ANADIG_BASE_ADDR; + +	clrsetbits_le32(&ccm->ccgr0, CCM_REG_CTRL_MASK, +		CCM_CCGR0_UART1_CTRL_MASK); +	clrsetbits_le32(&ccm->ccgr1, CCM_REG_CTRL_MASK, +		CCM_CCGR1_PIT_CTRL_MASK | CCM_CCGR1_WDOGA5_CTRL_MASK); +	clrsetbits_le32(&ccm->ccgr2, CCM_REG_CTRL_MASK, +		CCM_CCGR2_IOMUXC_CTRL_MASK | CCM_CCGR2_PORTA_CTRL_MASK | +		CCM_CCGR2_PORTB_CTRL_MASK | CCM_CCGR2_PORTC_CTRL_MASK | +		CCM_CCGR2_PORTD_CTRL_MASK | CCM_CCGR2_PORTE_CTRL_MASK); +	clrsetbits_le32(&ccm->ccgr3, CCM_REG_CTRL_MASK, +		CCM_CCGR3_ANADIG_CTRL_MASK); +	clrsetbits_le32(&ccm->ccgr4, CCM_REG_CTRL_MASK, +		CCM_CCGR4_WKUP_CTRL_MASK | CCM_CCGR4_CCM_CTRL_MASK | +		CCM_CCGR4_GPC_CTRL_MASK); +	clrsetbits_le32(&ccm->ccgr6, CCM_REG_CTRL_MASK, +		CCM_CCGR6_OCOTP_CTRL_MASK | CCM_CCGR6_DDRMC_CTRL_MASK); +	clrsetbits_le32(&ccm->ccgr7, CCM_REG_CTRL_MASK, +		CCM_CCGR7_SDHC1_CTRL_MASK); +	clrsetbits_le32(&ccm->ccgr9, CCM_REG_CTRL_MASK, +		CCM_CCGR9_FEC0_CTRL_MASK | CCM_CCGR9_FEC1_CTRL_MASK); + +	clrsetbits_le32(&anadig->pll2_ctrl, ANADIG_PLL2_CTRL_POWERDOWN, +		ANADIG_PLL2_CTRL_ENABLE | ANADIG_PLL2_CTRL_DIV_SELECT); +	clrsetbits_le32(&anadig->pll1_ctrl, ANADIG_PLL1_CTRL_POWERDOWN, +		ANADIG_PLL1_CTRL_ENABLE | ANADIG_PLL1_CTRL_DIV_SELECT); + +	clrsetbits_le32(&ccm->ccr, CCM_CCR_OSCNT_MASK, +		CCM_CCR_FIRC_EN | CCM_CCR_OSCNT(5)); +	clrsetbits_le32(&ccm->ccsr, CCM_REG_CTRL_MASK, +		CCM_CCSR_PLL1_PFD_CLK_SEL(3) | CCM_CCSR_PLL2_PFD4_EN | +		CCM_CCSR_PLL2_PFD3_EN | CCM_CCSR_PLL2_PFD2_EN | +		CCM_CCSR_PLL2_PFD1_EN | CCM_CCSR_PLL1_PFD4_EN | +		CCM_CCSR_PLL1_PFD3_EN | CCM_CCSR_PLL1_PFD2_EN | +		CCM_CCSR_PLL1_PFD1_EN | CCM_CCSR_DDRC_CLK_SEL(1) | +		CCM_CCSR_FAST_CLK_SEL(1) | CCM_CCSR_SYS_CLK_SEL(4)); +	clrsetbits_le32(&ccm->cacrr, CCM_REG_CTRL_MASK, +		CCM_CACRR_IPG_CLK_DIV(1) | CCM_CACRR_BUS_CLK_DIV(2) | +		CCM_CACRR_ARM_CLK_DIV(0)); +	clrsetbits_le32(&ccm->cscmr1, CCM_REG_CTRL_MASK, +		CCM_CSCMR1_ESDHC1_CLK_SEL(3)); +	clrsetbits_le32(&ccm->cscdr1, CCM_REG_CTRL_MASK, +		CCM_CSCDR1_RMII_CLK_EN); +	clrsetbits_le32(&ccm->cscdr2, CCM_REG_CTRL_MASK, +		CCM_CSCDR2_ESDHC1_EN | CCM_CSCDR2_ESDHC1_CLK_DIV(0)); +	clrsetbits_le32(&ccm->cscmr2, CCM_REG_CTRL_MASK, +		CCM_CSCMR2_RMII_CLK_SEL(0)); +} + +static void mscm_init(void) +{ +	struct mscm_ir *mscmir = (struct mscm_ir *)MSCM_IR_BASE_ADDR; +	int i; + +	for (i = 0; i < MSCM_IRSPRC_NUM; i++) +		writew(MSCM_IRSPRC_CP0_EN, &mscmir->irsprc[i]); +} + +int board_phy_config(struct phy_device *phydev) +{ +	if (phydev->drv->config) +		phydev->drv->config(phydev); + +	return 0; +} + +int board_early_init_f(void) +{ +	clock_init(); +	mscm_init(); + +	setup_iomux_uart(); +	setup_iomux_enet(); + +	return 0; +} + +int board_init(void) +{ +	/* address of boot parameters */ +	gd->bd->bi_boot_params = PHYS_SDRAM + 0x100; + +	return 0; +} + +int checkboard(void) +{ +	puts("Board: vf610twr\n"); + +	return 0; +} diff --git a/board/genesi/mx51_efikamx/imximage_mx.cfg b/board/genesi/mx51_efikamx/imximage_mx.cfg index 21ff6d678..01735359a 100644 --- a/board/genesi/mx51_efikamx/imximage_mx.cfg +++ b/board/genesi/mx51_efikamx/imximage_mx.cfg @@ -26,7 +26,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/genesi/mx51_efikamx/imximage_sb.cfg b/board/genesi/mx51_efikamx/imximage_sb.cfg index 7ddd0b15b..5c46769b4 100644 --- a/board/genesi/mx51_efikamx/imximage_sb.cfg +++ b/board/genesi/mx51_efikamx/imximage_sb.cfg @@ -26,7 +26,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/htkw/mcx/mcx.c b/board/htkw/mcx/mcx.c index 923461a39..7f0330dc0 100644 --- a/board/htkw/mcx/mcx.c +++ b/board/htkw/mcx/mcx.c @@ -28,7 +28,7 @@  #include <asm/gpio.h>  #include <asm/omap_gpio.h>  #include <asm/arch/dss.h> -#include <asm/arch/clocks.h> +#include <asm/arch/clock.h>  #include "errno.h"  #include <i2c.h>  #ifdef CONFIG_USB_EHCI diff --git a/board/alaska/Makefile b/board/icpdas/lp8x4x/Makefile index a21f8516a..cbe6aa9ad 100644 --- a/board/alaska/Makefile +++ b/board/icpdas/lp8x4x/Makefile @@ -1,9 +1,7 @@  # -# (C) Copyright 2003-2006 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# ICPDAS LP-8x4x Support  # -# See file CREDITS for list of people who contributed to this -# project. +# Copyright (C) 2013 Sergey Yanovich <ynvich@gmail.com>  #  # This program is free software; you can redistribute it and/or  # modify it under the terms of the GNU General Public License as @@ -25,13 +23,12 @@ include $(TOPDIR)/config.mk  LIB	= $(obj)lib$(BOARD).o -COBJS	:= $(BOARD).o flash.o +COBJS	:= lp8x4x.o -SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) +SRCS	:= $(COBJS:.o=.c)  OBJS	:= $(addprefix $(obj),$(COBJS)) -SOBJS	:= $(addprefix $(obj),$(SOBJS)) -$(LIB):	$(OBJS) +$(LIB):	$(obj).depend $(OBJS)  	$(call cmd_link_o_target, $(OBJS))  ######################################################################### diff --git a/board/icpdas/lp8x4x/lp8x4x.c b/board/icpdas/lp8x4x/lp8x4x.c new file mode 100644 index 000000000..76f070056 --- /dev/null +++ b/board/icpdas/lp8x4x/lp8x4x.c @@ -0,0 +1,147 @@ +/* + * ICP DAS LP-8x4x Support + * + * Copyright (C) 2010 Marek Vasut <marek.vasut@gmail.com> + * adapted from Voipac PXA270 Support by + * Copyright (C) 2013 Sergey Yanovich <ynvich@gmail.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/arch/hardware.h> +#include <asm/arch/regs-mmc.h> +#include <asm/arch/pxa.h> +#include <netdev.h> +#include <serial.h> +#include <asm/io.h> + +DECLARE_GLOBAL_DATA_PTR; + +/* + * Miscelaneous platform dependent initialisations + */ +int board_init(void) +{ +	/* We have RAM, disable cache */ +	dcache_disable(); +	icache_disable(); + +	/* memory and cpu-speed are setup before relocation */ +	/* so we do _nothing_ here */ + +	/* adress of boot parameters */ +	gd->bd->bi_boot_params = 0xa0000100; + +	return 0; +} + +int dram_init(void) +{ +	pxa2xx_dram_init(); +	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); +	return 0; +} + +void dram_init_banksize(void) +{ +	gd->bd->bi_dram[0].start = PHYS_SDRAM_1; +	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; +} + +#ifdef	CONFIG_CMD_MMC +int board_mmc_init(bd_t *bis) +{ +	pxa_mmc_register(0); +	return 0; +} +#endif + +#ifdef	CONFIG_CMD_USB +int usb_board_init(void) +{ +	writel((UHCHR | UHCHR_PCPL | UHCHR_PSPL) & +		~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE), +		UHCHR); + +	writel(readl(UHCHR) | UHCHR_FSBIR, UHCHR); + +	while (readl(UHCHR) & UHCHR_FSBIR) +		continue; /* required by checkpath.pl */ + +	writel(readl(UHCHR) & ~UHCHR_SSE, UHCHR); +	writel((UHCHIE_UPRIE | UHCHIE_RWIE), UHCHIE); + +	/* Clear any OTG Pin Hold */ +	if (readl(PSSR) & PSSR_OTGPH) +		writel(readl(PSSR) | PSSR_OTGPH, PSSR); + +	writel(readl(UHCRHDA) & ~(0x200), UHCRHDA); +	writel(readl(UHCRHDA) | 0x100, UHCRHDA); + +	/* Set port power control mask bits, only 3 ports. */ +	writel(readl(UHCRHDB) | (0x7<<17), UHCRHDB); + +	/* enable port 2 */ +	writel(readl(UP2OCR) | UP2OCR_HXOE | UP2OCR_HXS | +		UP2OCR_DMPDE | UP2OCR_DPPDE, UP2OCR); + +	return 0; +} + +void usb_board_init_fail(void) +{ +	return; +} + +void usb_board_stop(void) +{ +	writel(readl(UHCHR) | UHCHR_FHR, UHCHR); +	udelay(11); +	writel(readl(UHCHR) & ~UHCHR_FHR, UHCHR); + +	writel(readl(UHCCOMS) | 1, UHCCOMS); +	udelay(10); + +	writel(readl(CKEN) & ~CKEN10_USBHOST, CKEN); + +	return; +} +#endif + +#ifdef CONFIG_DRIVER_DM9000 +void lp8x4x_eth1_mac_init(void) +{ +	u8 eth1addr[8]; +	int i; +	u8 reg; + +	eth_getenv_enetaddr_by_index("eth", 1, eth1addr); +	if (!is_valid_ether_addr(eth1addr)) +		return; + +	for (i = 0, reg = 0x10; i < 6; i++, reg++) { +		writeb(reg, (u8 *)(DM9000_IO_2)); +		writeb(eth1addr[i], (u8 *)(DM9000_DATA_2)); +	} +} + +int board_eth_init(bd_t *bis) +{ +	lp8x4x_eth1_mac_init(); +	return dm9000_initialize(bis); +} +#endif diff --git a/board/iomega/iconnect/kwbimage.cfg b/board/iomega/iconnect/kwbimage.cfg index 4b64dab59..1b66207b7 100644 --- a/board/iomega/iconnect/kwbimage.cfg +++ b/board/iomega/iconnect/kwbimage.cfg @@ -19,7 +19,7 @@  # You should have received a copy of the GNU General Public License  # along with this program. If not, see <http://www.gnu.org/licenses/>.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/isee/igep0033/board.c b/board/isee/igep0033/board.c index d315516fe..826ceadd8 100644 --- a/board/isee/igep0033/board.c +++ b/board/isee/igep0033/board.c @@ -105,6 +105,15 @@ static struct emif_regs ddr3_emif_reg_data = {   */  void s_init(void)  { +	/* +	 * Save the boot parameters passed from romcode. +	 * We cannot delay the saving further than this, +	 * to prevent overwrites. +	 */ +#ifdef CONFIG_SPL_BUILD +	save_omap_boot_params(); +#endif +  	/* WDT1 is already running when the bootloader gets control  	 * Disable it to avoid "random" resets  	 */ diff --git a/board/karo/tk71/kwbimage.cfg b/board/karo/tk71/kwbimage.cfg index 0166826e7..9a9cf9def 100644 --- a/board/karo/tk71/kwbimage.cfg +++ b/board/karo/tk71/kwbimage.cfg @@ -24,7 +24,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c index 2952eba8c..461e21f3f 100644 --- a/board/karo/tx25/tx25.c +++ b/board/karo/tx25/tx25.c @@ -35,7 +35,21 @@ DECLARE_GLOBAL_DATA_PTR;  #ifdef CONFIG_SPL_BUILD  void board_init_f(ulong bootflag)  { -	relocate_code(CONFIG_SPL_TEXT_BASE); +	/* +	 * copy ourselves from where we are running to where we were +	 * linked at. Use ulong pointers as all addresses involved +	 * are 4-byte-aligned. +	 */ +	ulong *start_ptr, *end_ptr, *link_ptr, *run_ptr, *dst; +	asm volatile ("ldr %0, =_start" : "=r"(start_ptr)); +	asm volatile ("ldr %0, =_end" : "=r"(end_ptr)); +	asm volatile ("ldr %0, =board_init_f" : "=r"(link_ptr)); +	asm volatile ("adr %0, board_init_f" : "=r"(run_ptr)); +	for (dst = start_ptr; dst < end_ptr; dst++) +		*dst = *(dst+(run_ptr-link_ptr)); +	/* +	 * branch to nand_boot's link-time address. +	 */  	asm volatile("ldr pc, =nand_boot");  }  #endif diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index eda9199bb..b9448873c 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -160,7 +160,7 @@ int ethernet_present(void)  }  #endif -int initialize_unit_leds(void) +static int initialize_unit_leds(void)  {  	/*  	 * Init the unit LEDs per default they all are @@ -181,7 +181,7 @@ int initialize_unit_leds(void)  }  #if defined(CONFIG_BOOTCOUNT_LIMIT) -void set_bootcount_addr(void) +static void set_bootcount_addr(void)  {  	uchar buf[32];  	unsigned int bootcountaddr; diff --git a/board/keymile/km_arm/kwbimage-memphis.cfg b/board/keymile/km_arm/kwbimage-memphis.cfg index 5aa0de252..63822a5cf 100644 --- a/board/keymile/km_arm/kwbimage-memphis.cfg +++ b/board/keymile/km_arm/kwbimage-memphis.cfg @@ -23,7 +23,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/keymile/km_arm/kwbimage.cfg b/board/keymile/km_arm/kwbimage.cfg index e5e9942c1..d941d7e73 100644 --- a/board/keymile/km_arm/kwbimage.cfg +++ b/board/keymile/km_arm/kwbimage.cfg @@ -20,7 +20,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/keymile/km_arm/kwbimage_128M16_1.cfg b/board/keymile/km_arm/kwbimage_128M16_1.cfg index 5de8df70f..4c31a0df0 100644 --- a/board/keymile/km_arm/kwbimage_128M16_1.cfg +++ b/board/keymile/km_arm/kwbimage_128M16_1.cfg @@ -25,7 +25,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/keymile/km_arm/kwbimage_256M8_1.cfg b/board/keymile/km_arm/kwbimage_256M8_1.cfg index d0a09f61d..31b920329 100644 --- a/board/keymile/km_arm/kwbimage_256M8_1.cfg +++ b/board/keymile/km_arm/kwbimage_256M8_1.cfg @@ -22,7 +22,7 @@  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,  # MA 02110-1301 USA  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  #  # This configuration applies to COGE5 design (ARM-part) diff --git a/board/nvidia/beaver/Makefile b/board/nvidia/beaver/Makefile new file mode 100644 index 000000000..9510f607a --- /dev/null +++ b/board/nvidia/beaver/Makefile @@ -0,0 +1,38 @@ +# +# Copyright (c) 2010-2013, NVIDIA CORPORATION.  All rights reserved. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms and conditions of the GNU General Public License, +# version 2, as published by the Free Software Foundation. +# +# This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>. +# + +include $(TOPDIR)/config.mk + +$(shell mkdir -p $(obj)../cardhu) + +LIB	= $(obj)lib$(BOARD).o + +COBJS	= ../cardhu/cardhu.o + +SRCS	:= $(COBJS:.o=.c) +OBJS	:= $(addprefix $(obj),$(COBJS)) + +$(LIB):	$(obj).depend $(OBJS) +	$(call cmd_link_o_target, $(OBJS)) + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/openrisc/openrisc-generic/u-boot.lds b/board/openrisc/openrisc-generic/u-boot.lds deleted file mode 100644 index 9024f30b3..000000000 --- a/board/openrisc/openrisc-generic/u-boot.lds +++ /dev/null @@ -1,77 +0,0 @@ -#include <config.h> -OUTPUT_ARCH(or32) -__DYNAMIC  =  0; - -MEMORY -{ -	vectors	: ORIGIN = 0, LENGTH = 0x2000 -	ram	: ORIGIN = CONFIG_SYS_MONITOR_BASE, -		  LENGTH = CONFIG_SYS_MONITOR_LEN -} - -SECTIONS -{ -	.vectors : -	{ -		*(.vectors) -	} > vectors - -	__start = .; -	.text : AT (__start) { -		_stext = .; -		*(.text) -		_etext = .; -		*(.lit) -		*(.shdata) -		_endtext = .; -	}  > ram - - -	 . = ALIGN(4); -	 .u_boot_list : { -		KEEP(*(SORT(.u_boot_list*))); -	 } - -	.rodata : { -		*(.rodata); -		*(.rodata.*) -	} > ram - -	.shbss : -	{ -		*(.shbss) -	} > ram - -	.talias : -	{ -	}  > ram - -	.data : { -		sdata = .; -		_sdata = .; -		*(.data) -		edata = .; -		_edata = .; -	} > ram - -	.bss : -	{ -		_bss_start = .; -		*(.bss) -		*(COMMON) -		_bss_end = .; -	} > ram -	__end = .; - -	/* No stack specification - done manually */ - -	.stab  0 (NOLOAD) : -	{ -		[ .stab ] -	} - -	.stabstr  0 (NOLOAD) : -	{ -		[ .stabstr ] -	} -} diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c index 43d7b6e15..93c611dfc 100644 --- a/board/phytec/pcm051/board.c +++ b/board/phytec/pcm051/board.c @@ -115,6 +115,15 @@ static struct emif_regs ddr3_emif_reg_data = {  void s_init(void)  {  	/* +	 * Save the boot parameters passed from romcode. +	 * We cannot delay the saving further than this, +	 * to prevent overwrites. +	 */ +#ifdef CONFIG_SPL_BUILD +	save_omap_boot_params(); +#endif + +	/*  	 * WDT1 is already running when the bootloader gets control  	 * Disable it to avoid "random" resets  	 */ diff --git a/board/raidsonic/ib62x0/kwbimage.cfg b/board/raidsonic/ib62x0/kwbimage.cfg index bade627cc..27a5e314a 100644 --- a/board/raidsonic/ib62x0/kwbimage.cfg +++ b/board/raidsonic/ib62x0/kwbimage.cfg @@ -20,7 +20,7 @@  # You should have received a copy of the GNU General Public License  # along with this program. If not, see <http://www.gnu.org/licenses/>.  # -# Refer docs/README.kwimage for more details about how-to configure +# Refer doc/README.kwbimage for more details about how-to configure  # and create kirkwood boot image  # diff --git a/board/sorcery/sorcery.c b/board/sorcery/sorcery.c deleted file mode 100644 index 90d429802..000000000 --- a/board/sorcery/sorcery.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * (C) Copyright 2004, Freescale Inc. - * TsiChung Liew, Tsi-Chung.Liew@freescale.com - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> -#include <mpc8220.h> -#include <asm/processor.h> -#include <asm/mmu.h> -#include <pci.h> -#include <netdev.h> - -phys_size_t initdram (int board_type) -{ -	ulong size; - -	size = dramSetup (); - -	return get_ram_size(CONFIG_SYS_SDRAM_BASE, size); -} - -int checkboard (void) -{ -	puts ("Board: Sorcery-C MPC8220\n"); - -	return 0; -} - -#if defined(CONFIG_PCI) -/* - * Initialize PCI devices, report devices found. - */ -static struct pci_controller hose; - -#endif /* CONFIG_PCI */ - -void pci_init_board (void) -{ -#ifdef CONFIG_PCI -	extern void pci_mpc8220_init (struct pci_controller *hose); -	pci_mpc8220_init (&hose); -#endif /* CONFIG_PCI */ -} - -int board_eth_init(bd_t *bis) -{ -	/* Initialize built-in FEC first */ -	cpu_eth_init(bis); -	return pci_eth_init(bis); -} diff --git a/board/teejet/mt_ventoux/mt_ventoux.c b/board/teejet/mt_ventoux/mt_ventoux.c index 8347cf9ce..5c7309888 100644 --- a/board/teejet/mt_ventoux/mt_ventoux.c +++ b/board/teejet/mt_ventoux/mt_ventoux.c @@ -31,7 +31,7 @@  #include <asm/omap_gpio.h>  #include <asm/arch/mmc_host_def.h>  #include <asm/arch/dss.h> -#include <asm/arch/clocks.h> +#include <asm/arch/clock.h>  #include <i2c.h>  #include <spartan3.h>  #include <asm/gpio.h> diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index b371376bc..06e8f07c4 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -304,6 +304,15 @@ static struct emif_regs ddr3_evm_emif_reg_data = {   */  void s_init(void)  { +	/* +	 * Save the boot parameters passed from romcode. +	 * We cannot delay the saving further than this, +	 * to prevent overwrites. +	 */ +#ifdef CONFIG_SPL_BUILD +	save_omap_boot_params(); +#endif +  	/* WDT1 is already running when the bootloader gets control  	 * Disable it to avoid "random" resets  	 */ @@ -496,6 +505,7 @@ int board_eth_init(bd_t *bis)  			eth_setenv_enetaddr("ethaddr", mac_addr);  	} +#ifdef CONFIG_DRIVER_TI_CPSW  	if (board_is_bone() || board_is_bone_lt() || board_is_idk()) {  		writel(MII_MODE_ENABLE, &cdev->miisel);  		cpsw_slaves[0].phy_if = cpsw_slaves[1].phy_if = @@ -511,6 +521,7 @@ int board_eth_init(bd_t *bis)  		printf("Error %d registering CPSW switch\n", rv);  	else  		n += rv; +#endif  	/*  	 * diff --git a/board/ti/dra7xx/mux_data.h b/board/ti/dra7xx/mux_data.h index 04c95fd37..338a241ce 100644 --- a/board/ti/dra7xx/mux_data.h +++ b/board/ti/dra7xx/mux_data.h @@ -29,19 +29,29 @@  #include <asm/arch/mux_dra7xx.h>  const struct pad_conf_entry core_padconf_array_essential[] = { -	{MMC1_CLK, (PTU | IEN | M0)},	/* MMC1_CLK */ -	{MMC1_CMD, (PTU | IEN | M0)},   /* MMC1_CMD */ -	{MMC1_DAT0, (PTU | IEN | M0)},  /* MMC1_DAT0 */ -	{MMC1_DAT1, (PTU | IEN | M0)},  /* MMC1_DAT1 */ -	{MMC1_DAT2, (PTU | IEN | M0)},  /* MMC1_DAT2 */ -	{MMC1_DAT3, (PTU | IEN | M0)},  /* MMC1_DAT3 */ -	{MMC1_SDCD, (PTU | IEN | M0)},  /* MMC1_SDCD */ -	{MMC1_SDWP, (PTU | IEN | M0)},  /* MMC1_SDWP */ -	{UART1_RXD, (PTU | IEN | M0)},  /* UART1_RXD */ -	{UART1_TXD, (M0)},              /* UART1_TXD */ -	{UART1_CTSN, (PTU | IEN | M0)}, /* UART1_CTSN */ -	{UART1_RTSN, (M0)},             /* UART1_RTSN */ -	{I2C1_SDA, (PTU | IEN | M0)},   /* I2C1_SDA */ -	{I2C1_SCL, (PTU | IEN | M0)},   /* I2C1_SCL */ +	{MMC1_CLK, (IEN | PTU | PDIS | M0)},	/* MMC1_CLK */ +	{MMC1_CMD, (IEN | PTU | PDIS | M0)},	/* MMC1_CMD */ +	{MMC1_DAT0, (IEN | PTU | PDIS | M0)},	/* MMC1_DAT0 */ +	{MMC1_DAT1, (IEN | PTU | PDIS | M0)},	/* MMC1_DAT1 */ +	{MMC1_DAT2, (IEN | PTU | PDIS | M0)},	/* MMC1_DAT2 */ +	{MMC1_DAT3, (IEN | PTU | PDIS | M0)},	/* MMC1_DAT3 */ +	{MMC1_SDCD, (FSC | IEN | PTU | PDIS | M0)}, /* MMC1_SDCD */ +	{MMC1_SDWP, (FSC | IEN | PTD | PEN | M14)}, /* MMC1_SDWP */ +	{GPMC_A19, (IEN | PTU | PDIS | M1)},	/* mmc2_dat4 */ +	{GPMC_A20, (IEN | PTU | PDIS | M1)},	/* mmc2_dat5 */ +	{GPMC_A21, (IEN | PTU | PDIS | M1)},	/* mmc2_dat6 */ +	{GPMC_A22, (IEN | PTU | PDIS | M1)},	/* mmc2_dat7 */ +	{GPMC_A23, (IEN | PTU | PDIS | M1)},	/* mmc2_clk */ +	{GPMC_A24, (IEN | PTU | PDIS | M1)},	/* mmc2_dat0 */ +	{GPMC_A25, (IEN | PTU | PDIS | M1)},	/* mmc2_dat1 */ +	{GPMC_A26, (IEN | PTU | PDIS | M1)},	/* mmc2_dat2 */ +	{GPMC_A27, (IEN | PTU | PDIS | M1)},	/* mmc2_dat3 */ +	{GPMC_CS1, (IEN | PTU | PDIS | M1)},	/* mmm2_cmd */ +	{UART1_RXD, (FSC | IEN | PTU | PDIS | M0)}, /* UART1_RXD */ +	{UART1_TXD, (FSC | IEN | PTU | PDIS | M0)}, /* UART1_TXD */ +	{UART1_CTSN, (IEN | PTU | PDIS | M3)},	/* UART1_CTSN */ +	{UART1_RTSN, (IEN | PTU | PDIS | M3)},	/* UART1_RTSN */ +	{I2C1_SDA, (IEN | PTU | PDIS | M0)},	/* I2C1_SDA */ +	{I2C1_SCL, (IEN | PTU | PDIS | M0)},	/* I2C1_SCL */  };  #endif /* _MUX_DATA_DRA7XX_H_ */ diff --git a/board/ti/omap2420h4/config.mk b/board/ti/omap2420h4/config.mk deleted file mode 100644 index e5dff69a1..000000000 --- a/board/ti/omap2420h4/config.mk +++ /dev/null @@ -1,28 +0,0 @@ -# -# (C) Copyright 2004 -# Texas Instruments, <www.ti.com> -# -# TI H4 board with OMAP2420 (ARM1136) cpu -# see http://www.ti.com/ for more information on Texas Instruments -# -# H4 has 1 bank of 32MB or 64MB mDDR-SDRAM on CS0 -# H4 has 1 bank of 32MB or 00MB mDDR-SDRAM on CS1 -# Physical Address: -# 8000'0000 (bank0) -# A000/0000 (bank1) ES2 will be configurable -# Linux-Kernel is expected to be at 8000'8000, entry 8000'8000 -# (mem base + reserved) - -# For use with external or internal boots. -#CONFIG_SYS_TEXT_BASE = 0x80e80000 - -# Used with full SRAM boot. -# This is either with a GP system or a signed boot image. -# easiest, and safest way to go if you can. -#CONFIG_SYS_TEXT_BASE = 0x40270000 - - -# Handy to get symbols to debug ROM version. -#CONFIG_SYS_TEXT_BASE = 0x0 -CONFIG_SYS_TEXT_BASE = 0x08000000 -#CONFIG_SYS_TEXT_BASE = 0x04000000 diff --git a/board/ti/omap2420h4/lowlevel_init.S b/board/ti/omap2420h4/lowlevel_init.S deleted file mode 100644 index 731c552e7..000000000 --- a/board/ti/omap2420h4/lowlevel_init.S +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Board specific setup info - * - * (C) Copyright 2004 - * Texas Instruments, <www.ti.com> - * Richard Woodruff <r-woodruff2@ti.com> - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <config.h> -#include <version.h> -#include <asm/arch/omap2420.h> -#include <asm/arch/mem.h> -#include <asm/arch/clocks.h> - -_TEXT_BASE: -	.word	CONFIG_SYS_TEXT_BASE	/* sdram load addr from config.mk */ - -/************************************************************************** - * cpy_clk_code: relocates clock code into SRAM where its safer to execute - * R1 = SRAM destination address. - *************************************************************************/ -.global cpy_clk_code - cpy_clk_code: -	/* Copy DPLL code into SRAM */ -	adr	r0, go_to_speed		/* get addr of clock setting code */ -	mov	r2, #384		/* r2 size to copy (div by 32 bytes) */ -	mov	r1, r1			/* r1 <- dest address (passed in) */ -	add	r2, r2, r0		/* r2 <- source end address */ -next2: -	ldmia	r0!, {r3-r10}		/* copy from source address [r0]    */ -	stmia	r1!, {r3-r10}		/* copy to   target address [r1]    */ -	cmp	r0, r2			/* until source end address [r2]    */ -	bne	next2 -	mov	pc, lr			/* back to caller */ - -/* **************************************************************************** - *  go_to_speed: -Moves to bypass, -Commits clock dividers, -puts dpll at speed - *		 -executed from SRAM. - *  R0 = PRCM_CLKCFG_CTRL - addr of valid reg - *  R1 = CM_CLKEN_PLL - addr dpll ctlr reg - *  R2 = dpll value - *  R3 = CM_IDLEST_CKGEN - addr dpll lock wait - ******************************************************************************/ -.global go_to_speed - go_to_speed: -	sub	sp, sp, #0x4 /* get some stack space */ -	str	r4, [sp]     /* save r4's value */ - -	/* move into fast relock bypass */ -	ldr	r8, pll_ctl_add -	mov	r4, #0x2 -	str	r4, [r8] -	ldr	r4, pll_stat -block: -	ldr	r8, [r4]	/* wait for bypass to take effect */ -	and	r8, r8, #0x3 -	cmp	r8, #0x1 -	bne	block - -	/* set new dpll dividers _after_ in bypass */ -	ldr	r4, pll_div_add -	ldr	r8, pll_div_val -	str	r8, [r4] - -	/* now prepare GPMC (flash) for new dpll speed */ -	/* flash needs to be stable when we jump back to it */ -	ldr	r4, cfg3_0_addr -	ldr	r8, cfg3_0_val -	str	r8, [r4] -	ldr	r4, cfg4_0_addr -	ldr	r8, cfg4_0_val -	str	r8, [r4] -	ldr	r4, cfg1_0_addr -	ldr	r8, [r4] -	orr	r8, r8, #0x3	 /* up gpmc divider */ -	str	r8, [r4] - -	/* setup to 2x loop though code.  The first loop pre-loads the -	 * icache, the 2nd commits the prcm config, and locks the dpll -	 */ -	mov	r4, #0x1000	 /* spin spin spin */ -	mov	r8, #0x4	 /* first pass condition & set registers */ -	cmp	r8, #0x4 -2: -	ldrne	r8, [r3]	 /* DPLL lock check */ -	and	r8, r8, #0x7 -	cmp	r8, #0x2 -	beq	4f -3: -	subeq	r8, r8, #0x1 -	streq	r8, [r0]	 /* commit dividers (2nd time) */ -	nop -lloop1: -	sub	r4, r4, #0x1	/* Loop currently necessary else bad jumps */ -	nop -	cmp	r4, #0x0 -	bne	lloop1 -	mov	r4, #0x40000 -	cmp	r8, #0x1 -	nop -	streq	r2, [r1]	/* lock dpll (2nd time) */ -	nop -lloop2: -	sub	r4, r4, #0x1	/* loop currently necessary else bad jumps */ -	nop -	cmp	r4, #0x0 -	bne	lloop2 -	mov	r4, #0x40000 -	cmp	r8, #0x1 -	nop -	ldreq	r8, [r3]	 /* get lock condition for dpll */ -	cmp	r8, #0x4	 /* first time though? */ -	bne	2b -	moveq	r8, #0x2	 /* set to dpll check condition. */ -	beq	3b		 /* if condition not true branch */ -4: -	ldr	r4, [sp] -	add	sp, sp, #0x4	 /* return stack space */ -	mov	pc, lr		 /* back to caller, locked */ - -_go_to_speed: .word go_to_speed - -/* these constants need to be close for PIC code */ -cfg3_0_addr: -    .word  GPMC_CONFIG3_0 -cfg3_0_val: -    .word  H4_24XX_GPMC_CONFIG3_0 -cfg4_0_addr: -    .word  GPMC_CONFIG4_0 -cfg4_0_val: -    .word  H4_24XX_GPMC_CONFIG4_0 -cfg1_0_addr: -    .word  GPMC_CONFIG1_0 -pll_ctl_add: -    .word CM_CLKEN_PLL -pll_stat: -    .word CM_IDLEST_CKGEN -pll_div_add: -    .word CM_CLKSEL1_PLL -pll_div_val: -    .word DPLL_VAL	/* DPLL setting (300MHz default) */ - -.globl lowlevel_init -lowlevel_init: -	ldr	sp,	SRAM_STACK -	str	ip,	[sp]	/* stash old link register */ -	mov	ip,	lr	/* save link reg across call */ -	bl	s_init		/* go setup pll,mux,memory */ -	ldr	ip,	[sp]	/* restore save ip */ -	mov	lr,	ip	/* restore link reg */ - -	/* map interrupt controller */ -	ldr	r0,	VAL_INTH_SETUP -	mcr	p15, 0, r0, c15, c2, 4 - -	/* back to arch calling code */ -	mov	pc,	lr - -	/* the literal pools origin */ -	.ltorg - -REG_CONTROL_STATUS: -	.word CONTROL_STATUS -VAL_INTH_SETUP: -	.word PERIFERAL_PORT_BASE -SRAM_STACK: -	.word LOW_LEVEL_SRAM_STACK diff --git a/board/ti/omap2420h4/mem.c b/board/ti/omap2420h4/mem.c deleted file mode 100644 index ba3f12ade..000000000 --- a/board/ti/omap2420h4/mem.c +++ /dev/null @@ -1,362 +0,0 @@ -/* - * (C) Copyright 2004 - * Texas Instruments, <www.ti.com> - * Richard Woodruff <r-woodruff2@ti.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/arch/omap2420.h> -#include <asm/io.h> -#include <asm/arch/bits.h> -#include <asm/arch/mux.h> -#include <asm/arch/mem.h> -#include <asm/arch/clocks.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/sys_info.h> - -/************************************************************ - * sdelay() - simple spin loop.  Will be constant time as - *  its generally used in 12MHz bypass conditions only.  This - *  is necessary until timers are accessible. - * - *  not inline to increase chances its in cache when called - *************************************************************/ -void sdelay (unsigned long loops) -{ -	__asm__ volatile ("1:\n" "subs %0, %1, #1\n" -		"bne 1b":"=r" (loops):"0" (loops)); -} - -/********************************************************************************* - * prcm_init() - inits clocks for PRCM as defined in clocks.h (config II default). - *   -- called from SRAM, or Flash (using temp SRAM stack). - *********************************************************************************/ -void prcm_init(void) -{ -	u32 div; -	void (*f_lock_pll) (u32, u32, u32, u32); -	extern void *_end_vect, *_start; - -	f_lock_pll = (void *)((u32)&_end_vect - (u32)&_start + SRAM_VECT_CODE); - -	__raw_writel(0, CM_FCLKEN1_CORE);	   /* stop all clocks to reduce ringing */ -	__raw_writel(0, CM_FCLKEN2_CORE);	   /* may not be necessary */ -	__raw_writel(0, CM_ICLKEN1_CORE); -	__raw_writel(0, CM_ICLKEN2_CORE); - -	__raw_writel(DPLL_OUT, CM_CLKSEL2_PLL);	/* set DPLL out */ -	__raw_writel(MPU_DIV, CM_CLKSEL_MPU);	/* set MPU divider */ -	__raw_writel(DSP_DIV, CM_CLKSEL_DSP);	/* set dsp and iva dividers */ -	__raw_writel(GFX_DIV, CM_CLKSEL_GFX);	/* set gfx dividers */ - -	div = BUS_DIV; -	__raw_writel(div, CM_CLKSEL1_CORE);/* set L3/L4/USB/Display/Vlnc/SSi dividers */ -	sdelay(1000); - -	if(running_in_sram()){ -		/* If running fully from SRAM this is OK.  The Flash bus drops out for just a little. -		* but then comes back.  If running from Flash this sequence kills you, thus you need -		* to run it using CONFIG_PARTIAL_SRAM. -		*/ -		__raw_writel(MODE_BYPASS_FAST, CM_CLKEN_PLL); /* go to bypass, fast relock */ -		wait_on_value(BIT0|BIT1, BIT0, CM_IDLEST_CKGEN, LDELAY); /* wait till in bypass */ -		sdelay(1000); -		/* set clock selection and dpll dividers. */ -		__raw_writel(DPLL_VAL, CM_CLKSEL1_PLL);	 /* set pll for target rate */ -		__raw_writel(COMMIT_DIVIDERS, PRCM_CLKCFG_CTRL); /* commit dividers */ -		sdelay(10000); -		__raw_writel(DPLL_LOCK, CM_CLKEN_PLL); /* enable dpll */ -		sdelay(10000); -		wait_on_value(BIT0|BIT1, BIT1, CM_IDLEST_CKGEN, LDELAY);  /*wait for dpll lock */ -	}else if(running_in_flash()){ -		/* if running from flash, need to jump to small relocated code area in SRAM. -		 * This is the only safe spot to do configurations from. -		 */ -		(*f_lock_pll)(PRCM_CLKCFG_CTRL, CM_CLKEN_PLL, DPLL_LOCK, CM_IDLEST_CKGEN); -	} - -	__raw_writel(DPLL_LOCK|APLL_LOCK, CM_CLKEN_PLL);   /* enable apll */ -	wait_on_value(BIT8, BIT8, CM_IDLEST_CKGEN, LDELAY);	/* wait for apll lock */ -	sdelay(1000); -} - -/************************************************************************** - * make_cs1_contiguous() - for es2 and above remap cs1 behind cs0 to allow - *  command line mem=xyz use all memory with out discontigious support - *  compiled in.  Could do it at the ATAG, but there really is two banks... - * Called as part of 2nd phase DDR init. - **************************************************************************/ -void make_cs1_contiguous(void) -{ -	u32 size, a_add_low, a_add_high; - -	size = get_sdr_cs_size(SDRC_CS0_OSET); -	size /= SZ_32M;  /* find size to offset CS1 */ -	a_add_high = (size & 3) << 8;   /* set up low field */ -	a_add_low = (size & 0x3C) >> 2; /* set up high field */ -	__raw_writel((a_add_high|a_add_low),SDRC_CS_CFG); - -} - -/******************************************************** - *  mem_ok() - test used to see if timings are correct - *             for a part. Helps in gussing which part - *             we are currently using. - *******************************************************/ -u32 mem_ok(void) -{ -	u32 val1, val2; -	u32 pattern = 0x12345678; - -	__raw_writel(0x0,OMAP2420_SDRC_CS0+0x400);   /* clear pos A */ -	__raw_writel(pattern, OMAP2420_SDRC_CS0);    /* pattern to pos B */ -	__raw_writel(0x0,OMAP2420_SDRC_CS0+4);       /* remove pattern off the bus */ -	val1 = __raw_readl(OMAP2420_SDRC_CS0+0x400); /* get pos A value */ -	val2 = __raw_readl(OMAP2420_SDRC_CS0);       /* get val2 */ - -	if ((val1 != 0) || (val2 != pattern))        /* see if pos A value changed*/ -		return(0); -	else -		return(1); -} - - -/******************************************************** - *  sdrc_init() - init the sdrc chip selects CS0 and CS1 - *  - early init routines, called from flash or - *  SRAM. - *******************************************************/ -void sdrc_init(void) -{ -	#define EARLY_INIT 1 -	do_sdrc_init(SDRC_CS0_OSET, EARLY_INIT);  /* only init up first bank here */ -} - -/************************************************************************* - * do_sdrc_init(): initialize the SDRAM for use. - *  -called from low level code with stack only. - *  -code sets up SDRAM timing and muxing for 2422 or 2420. - *  -optimal settings can be placed here, or redone after i2c - *      inspection of board info - * - *  This is a bit ugly, but should handle all memory moduels - *   used with the H4. The first time though this code from s_init() - *   we configure the first chip select.  Later on we come back and - *   will configure the 2nd chip select if it exists. - * - **************************************************************************/ -void do_sdrc_init(u32 offset, u32 early) -{ -	u32 cpu, dllen=0, rev, common=0, cs0=0, pmask=0, pass_type, mtype; -	sdrc_data_t *sdata;	 /* do not change type */ -	u32 a, b, r; - -	static const sdrc_data_t sdrc_2422 = -	{ -		H4_2422_SDRC_SHARING, H4_2422_SDRC_MDCFG_0_DDR, 0 , H4_2422_SDRC_ACTIM_CTRLA_0, -		H4_2422_SDRC_ACTIM_CTRLB_0, H4_2422_SDRC_RFR_CTRL, H4_2422_SDRC_MR_0_DDR, -		0, H4_2422_SDRC_DLLAB_CTRL -	}; -	static const sdrc_data_t sdrc_2420 = -	{ -		H4_2420_SDRC_SHARING, H4_2420_SDRC_MDCFG_0_DDR, H4_2420_SDRC_MDCFG_0_SDR, -		H4_2420_SDRC_ACTIM_CTRLA_0, H4_2420_SDRC_ACTIM_CTRLB_0, -		H4_2420_SDRC_RFR_CTRL, H4_2420_SDRC_MR_0_DDR, H4_2420_SDRC_MR_0_SDR, -		H4_2420_SDRC_DLLAB_CTRL -	}; - -	if (offset == SDRC_CS0_OSET) -		cs0 = common = 1;  /* int regs shared between both chip select */ - -	cpu = get_cpu_type(); -	rev = get_cpu_rev(); - -	/* warning generated, though code generation is correct. this may bite later, -	 * but is ok for now. there is only so much C code you can do on stack only -	 * operation. -	 */ -	if (cpu == CPU_2422){ -		sdata = (sdrc_data_t *)&sdrc_2422; -		pass_type = STACKED; -	} else{ -		sdata = (sdrc_data_t *)&sdrc_2420; -		pass_type = IP_DDR; -	} - -	__asm__ __volatile__("": : :"memory");  /* limit compiler scope */ - -	if (!early && (((mtype = get_mem_type()) == DDR_COMBO)||(mtype == DDR_STACKED))) { -		if(mtype == DDR_COMBO){ -			pmask = BIT2;/* combo part has a shared CKE signal, can't use feature */ -			pass_type = COMBO_DDR; /* CS1 config */ -			__raw_writel((__raw_readl(SDRC_POWER)) & ~pmask, SDRC_POWER); -		} -		if(rev != CPU_2420_2422_ES1)	/* for es2 and above smooth things out */ -			make_cs1_contiguous(); -	} - -next_mem_type: -	if (common) {	/* do a SDRC reset between types to clear regs*/ -		__raw_writel(SOFTRESET, SDRC_SYSCONFIG);	/* reset sdrc */ -		wait_on_value(BIT0, BIT0, SDRC_STATUS, 12000000);/* wait till reset done set */ -		__raw_writel(0, SDRC_SYSCONFIG);		/* clear soft reset */ -		__raw_writel(sdata->sdrc_sharing, SDRC_SHARING); -#ifdef POWER_SAVE -		__raw_writel(__raw_readl(SMS_SYSCONFIG)|SMART_IDLE, SMS_SYSCONFIG); -		__raw_writel(sdata->sdrc_sharing|SMART_IDLE, SDRC_SHARING); -		__raw_writel((__raw_readl(SDRC_POWER)|BIT6), SDRC_POWER); -#endif -	} - -	if ((pass_type == IP_DDR) || (pass_type == STACKED)) /* (IP ddr-CS0),(2422-CS0/CS1) */ -		__raw_writel(sdata->sdrc_mdcfg_0_ddr, SDRC_MCFG_0+offset); -	else if (pass_type == COMBO_DDR){ /* (combo-CS0/CS1) */ -		__raw_writel(H4_2420_COMBO_MDCFG_0_DDR,SDRC_MCFG_0+offset); -	} else if (pass_type == IP_SDR){ /* ip sdr-CS0 */ -		__raw_writel(sdata->sdrc_mdcfg_0_sdr, SDRC_MCFG_0+offset); -	} - -	a = sdata->sdrc_actim_ctrla_0; -	b = sdata->sdrc_actim_ctrlb_0; -	r = sdata->sdrc_dllab_ctrl; - -	/* work around ES1 DDR issues */ -	if((pass_type != IP_SDR) && (rev == CPU_2420_2422_ES1)){ -		a = H4_242x_SDRC_ACTIM_CTRLA_0_ES1; -		b = H4_242x_SDRC_ACTIM_CTRLB_0_ES1; -		r = H4_242x_SDRC_RFR_CTRL_ES1; -	} - -	if (cs0) { -		__raw_writel(a, SDRC_ACTIM_CTRLA_0); -		__raw_writel(b, SDRC_ACTIM_CTRLB_0); -	} else { -		__raw_writel(a, SDRC_ACTIM_CTRLA_1); -		__raw_writel(b, SDRC_ACTIM_CTRLB_1); -	} -	__raw_writel(r, SDRC_RFR_CTRL+offset); - -	/* init sequence for mDDR/mSDR using manual commands (DDR is a bit different) */ -	__raw_writel(CMD_NOP, SDRC_MANUAL_0+offset); -	sdelay(5000);  /* susposed to be 100us per design spec for mddr/msdr */ -	__raw_writel(CMD_PRECHARGE, SDRC_MANUAL_0+offset); -	__raw_writel(CMD_AUTOREFRESH, SDRC_MANUAL_0+offset); -	__raw_writel(CMD_AUTOREFRESH, SDRC_MANUAL_0+offset); - -	/* -	 * CSx SDRC Mode Register -	 * Burst length = (4 - DDR) (2-SDR) -	 * Serial mode -	 * CAS latency = x -	 */ -	if(pass_type == IP_SDR) -		__raw_writel(sdata->sdrc_mr_0_sdr, SDRC_MR_0+offset); -	else -		__raw_writel(sdata->sdrc_mr_0_ddr, SDRC_MR_0+offset); - -	/* NOTE: ES1 242x _BUG_ DLL + External Bandwidth fix*/ -	if (rev == CPU_2420_2422_ES1){ -		dllen = (BIT0|BIT3); /* es1 clear both bit0 and bit3 */ -		__raw_writel((__raw_readl(SMS_CLASS_ARB0)|BURSTCOMPLETE_GROUP7) -			,SMS_CLASS_ARB0);/* enable bust complete for lcd */ -	} -	else -		dllen = BIT0|BIT1; /* es2, clear bit0, and 1 (set phase to 72) */ - -	/* enable & load up DLL with good value for 75MHz, and set phase to 90 -	 * ES1 recommends 90 phase, ES2 recommends 72 phase. -	 */ -	if (common && (pass_type != IP_SDR)) { -		__raw_writel(sdata->sdrc_dllab_ctrl, SDRC_DLLA_CTRL); -		__raw_writel(sdata->sdrc_dllab_ctrl & ~(BIT2|dllen), SDRC_DLLA_CTRL); -		__raw_writel(sdata->sdrc_dllab_ctrl, SDRC_DLLB_CTRL); -		__raw_writel(sdata->sdrc_dllab_ctrl & ~(BIT2|dllen) , SDRC_DLLB_CTRL); -	} -	sdelay(90000); - -	if(mem_ok()) -		return; /* STACKED, other configued type */ -	++pass_type; /* IPDDR->COMBODDR->IPSDR for CS0 */ -	goto next_mem_type; -} - -/***************************************************** - * gpmc_init(): init gpmc bus - * Init GPMC for x16, MuxMode (SDRAM in x32). - * This code can only be executed from SRAM or SDRAM. - *****************************************************/ -void gpmc_init(void) -{ -	u32 mux=0, mtype, mwidth, rev, tval; - -	rev  = get_cpu_rev(); -	if (rev == CPU_2420_2422_ES1) -		tval = 1; -	else -		tval = 0;  /* disable bit switched meaning */ - -	/* global settings */ -	__raw_writel(0x10, GPMC_SYSCONFIG);	/* smart idle */ -	__raw_writel(0x0, GPMC_IRQENABLE);	/* isr's sources masked */ -	__raw_writel(tval, GPMC_TIMEOUT_CONTROL);/* timeout disable */ -#ifdef CONFIG_SYS_NAND_BOOT -	__raw_writel(0x001, GPMC_CONFIG);	/* set nWP, disable limited addr */ -#else -	__raw_writel(0x111, GPMC_CONFIG);	/* set nWP, disable limited addr */ -#endif - -	/* discover bus connection from sysboot */ -	if (is_gpmc_muxed() == GPMC_MUXED) -		mux = BIT9; -	mtype = get_gpmc0_type(); -	mwidth = get_gpmc0_width(); - -	/* setup cs0 */ -	__raw_writel(0x0, GPMC_CONFIG7_0);	/* disable current map */ -	sdelay(1000); - -#ifdef CONFIG_SYS_NAND_BOOT -	__raw_writel(H4_24XX_GPMC_CONFIG1_0|mtype|mwidth, GPMC_CONFIG1_0); -#else -	__raw_writel(H4_24XX_GPMC_CONFIG1_0|mux|mtype|mwidth, GPMC_CONFIG1_0); -#endif - -#ifdef PRCM_CONFIG_III -	__raw_writel(H4_24XX_GPMC_CONFIG2_0, GPMC_CONFIG2_0); -#endif -	__raw_writel(H4_24XX_GPMC_CONFIG3_0, GPMC_CONFIG3_0); -	__raw_writel(H4_24XX_GPMC_CONFIG4_0, GPMC_CONFIG4_0); -#ifdef PRCM_CONFIG_III -	__raw_writel(H4_24XX_GPMC_CONFIG5_0, GPMC_CONFIG5_0); -	__raw_writel(H4_24XX_GPMC_CONFIG6_0, GPMC_CONFIG6_0); -#endif -	__raw_writel(H4_24XX_GPMC_CONFIG7_0, GPMC_CONFIG7_0);/* enable new mapping */ -	sdelay(2000); - -	/* setup cs1 */ -	__raw_writel(0, GPMC_CONFIG7_1); /* disable any mapping */ -	sdelay(1000); -	__raw_writel(H4_24XX_GPMC_CONFIG1_1|mux, GPMC_CONFIG1_1); -	__raw_writel(H4_24XX_GPMC_CONFIG2_1, GPMC_CONFIG2_1); -	__raw_writel(H4_24XX_GPMC_CONFIG3_1, GPMC_CONFIG3_1); -	__raw_writel(H4_24XX_GPMC_CONFIG4_1, GPMC_CONFIG4_1); -	__raw_writel(H4_24XX_GPMC_CONFIG5_1, GPMC_CONFIG5_1); -	__raw_writel(H4_24XX_GPMC_CONFIG6_1, GPMC_CONFIG6_1); -	__raw_writel(H4_24XX_GPMC_CONFIG7_1, GPMC_CONFIG7_1); /* enable mapping */ -	sdelay(2000); -} diff --git a/board/ti/omap2420h4/omap2420h4.c b/board/ti/omap2420h4/omap2420h4.c deleted file mode 100644 index 532e989ba..000000000 --- a/board/ti/omap2420h4/omap2420h4.c +++ /dev/null @@ -1,867 +0,0 @@ -/* - * (C) Copyright 2004 - * Texas Instruments, <www.ti.com> - * Richard Woodruff <r-woodruff2@ti.com> - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ -#include <common.h> -#include <netdev.h> -#include <asm/arch/omap2420.h> -#include <asm/io.h> -#include <asm/arch/bits.h> -#include <asm/arch/mux.h> -#include <asm/arch/sys_proto.h> -#include <asm/arch/sys_info.h> -#include <asm/arch/mem.h> -#include <i2c.h> -#include <asm/mach-types.h> - -DECLARE_GLOBAL_DATA_PTR; - -void wait_for_command_complete(unsigned int wd_base); - -/******************************************************* - * Routine: delay - * Description: spinning delay to use before udelay works - ******************************************************/ -static inline void delay (unsigned long loops) -{ -	__asm__ volatile ("1:\n" "subs %0, %1, #1\n" -		"bne 1b":"=r" (loops):"0" (loops)); -} - -/***************************************** - * Routine: board_init - * Description: Early hardware init. - *****************************************/ -int board_init (void) -{ -	gpmc_init(); /* in SRAM or SDRM, finish GPMC */ - -	gd->bd->bi_arch_number = MACH_TYPE_OMAP_H4;		/* board id for linux */ -	gd->bd->bi_boot_params = (OMAP2420_SDRC_CS0+0x100);	/* adress of boot parameters */ - -	return 0; -} - -/********************************************************** - * Routine: try_unlock_sram() - * Description: If chip is GP type, unlock the SRAM for - *  general use. - ***********************************************************/ -void try_unlock_sram(void) -{ -	/* if GP device unlock device SRAM for general use */ -	if (get_device_type() == GP_DEVICE) { -		__raw_writel(0xFF, A_REQINFOPERM0); -		__raw_writel(0xCFDE, A_READPERM0); -		__raw_writel(0xCFDE, A_WRITEPERM0); -	} -} - -/********************************************************** - * Routine: s_init - * Description: Does early system init of muxing and clocks. - * - Called path is with sram stack. - **********************************************************/ -void s_init(void) -{ -	int in_sdram = running_in_sdram(); - -	watchdog_init(); -	set_muxconf_regs(); -	delay(100); -	try_unlock_sram(); - -	if(!in_sdram) -		prcm_init(); - -	peripheral_enable(); -	icache_enable(); -	if (!in_sdram) -		sdrc_init(); -} - -/******************************************************* - * Routine: misc_init_r - * Description: Init ethernet (done here so udelay works) - ********************************************************/ -int misc_init_r (void) -{ -	ether_init(); /* better done here so timers are init'ed */ -	return(0); -} - -/**************************************** - * Routine: watchdog_init - * Description: Shut down watch dogs - *****************************************/ -void watchdog_init(void) -{ -	/* There are 4 watch dogs.  1 secure, and 3 general purpose. -	* The ROM takes care of the secure one. Of the 3 GP ones, -	* 1 can reset us directly, the other 2 only generate MPU interrupts. -	*/ -	__raw_writel(WD_UNLOCK1 ,WD2_BASE+WSPR); -	wait_for_command_complete(WD2_BASE); -	__raw_writel(WD_UNLOCK2 ,WD2_BASE+WSPR); - -#if MPU_WD_CLOCKED /* value 0x10 stick on aptix, BIT4 polarity seems oppsite*/ -	__raw_writel(WD_UNLOCK1 ,WD3_BASE+WSPR); -	wait_for_command_complete(WD3_BASE); -	__raw_writel(WD_UNLOCK2 ,WD3_BASE+WSPR); - -	__raw_writel(WD_UNLOCK1 ,WD4_BASE+WSPR); -	wait_for_command_complete(WD4_BASE); -	__raw_writel(WD_UNLOCK2 ,WD4_BASE+WSPR); -#endif -} - -/****************************************************** - * Routine: wait_for_command_complete - * Description: Wait for posting to finish on watchdog - ******************************************************/ -void wait_for_command_complete(unsigned int wd_base) -{ -	int pending = 1; -	do { -		pending = __raw_readl(wd_base+WWPS); -	} while (pending); -} - -/******************************************************************* - * Routine:ether_init - * Description: take the Ethernet controller out of reset and wait - *		   for the EEPROM load to complete. - ******************************************************************/ -void ether_init (void) -{ -#ifdef CONFIG_LAN91C96 -	int cnt = 20; - -	__raw_writeb(0x3,OMAP2420_CTRL_BASE+0x10a); /*protect->gpio95 */ - -	__raw_writew(0x0, LAN_RESET_REGISTER); -	do { -		__raw_writew(0x1, LAN_RESET_REGISTER); -		udelay (100); -		if (cnt == 0) -			goto h4reset_err_out; -		--cnt; -	} while (__raw_readw(LAN_RESET_REGISTER) != 0x1); - -	cnt = 20; - -	do { -		__raw_writew(0x0, LAN_RESET_REGISTER); -		udelay (100); -		if (cnt == 0) -			goto h4reset_err_out; -		--cnt; -	} while (__raw_readw(LAN_RESET_REGISTER) != 0x0000); -	udelay (1000); - -	*((volatile unsigned char *) ETH_CONTROL_REG) &= ~0x01; -	udelay (1000); - -	h4reset_err_out: -	return; -#endif -} - -/********************************************** - * Routine: dram_init - * Description: sets uboots idea of sdram size - **********************************************/ -int dram_init(void) -{ -	unsigned int size0=0,size1=0; -	u32 mtype, btype; -	u8 chg_on = 0x5; /* enable charge of back up battery */ -	u8 vmode_on = 0x8C; -	#define NOT_EARLY 0 - -	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); /* need this a bit early */ - -	btype = get_board_type(); -	mtype = get_mem_type(); - -	display_board_info(btype); -	if (btype == BOARD_H4_MENELAUS){ -		update_mux(btype,mtype); /* combo part on menelaus */ -		i2c_write(I2C_MENELAUS, 0x20, 1, &chg_on, 1); /*fix POR reset bug */ -		i2c_write(I2C_MENELAUS, 0x2, 1, &vmode_on, 1); /* VCORE change on VMODE */ -	} - -	if ((mtype == DDR_COMBO) || (mtype == DDR_STACKED)) { -		do_sdrc_init(SDRC_CS1_OSET, NOT_EARLY);	/* init other chip select */ -	} -	size0 = get_sdr_cs_size(SDRC_CS0_OSET); -	size1 = get_sdr_cs_size(SDRC_CS1_OSET); - -	gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, size0 + size1); - -	return 0; -} - -void dram_init_banksize(void) -{ -	unsigned int size0, size1; -	u32 rev; - -	rev = get_cpu_rev(); -	size0 = get_sdr_cs_size(SDRC_CS0_OSET); -	size1 = get_sdr_cs_size(SDRC_CS1_OSET); - -	if(rev == CPU_2420_2422_ES1) /* ES1's 128MB remap granularity isn't worth doing */ -		gd->bd->bi_dram[1].start = PHYS_SDRAM_2; -	else /* ES2 and above can remap at 32MB granularity */ -		gd->bd->bi_dram[1].start = PHYS_SDRAM_1+size0; -	gd->bd->bi_dram[1].size = size1; - -	gd->bd->bi_dram[0].start = PHYS_SDRAM_1; -	gd->bd->bi_dram[0].size = size0; -} - -/********************************************************** - * Routine: set_muxconf_regs - * Description: Setting up the configuration Mux registers - *              specific to the hardware - *********************************************************/ -void set_muxconf_regs (void) -{ -	muxSetupSDRC(); -	muxSetupGPMC(); -	muxSetupUsb0(); -	muxSetupUart3(); -	muxSetupI2C1(); -	muxSetupUART1(); -	muxSetupLCD(); -	muxSetupCamera(); -	muxSetupMMCSD(); -	muxSetupTouchScreen(); -	muxSetupHDQ(); -} - -/***************************************************************** - * Routine: peripheral_enable - * Description: Enable the clks & power for perifs (GPT2, UART1,...) - ******************************************************************/ -void peripheral_enable(void) -{ -	unsigned int v, if_clks=0, func_clks=0; - -	/* Enable GP2 timer.*/ -	if_clks |= BIT4; -	func_clks |= BIT4; -	v = __raw_readl(CM_CLKSEL2_CORE) | 0x4;	/* Sys_clk input OMAP2420_GPT2 */ -	__raw_writel(v, CM_CLKSEL2_CORE); -	__raw_writel(0x1, CM_CLKSEL_WKUP); - -#ifdef CONFIG_SYS_NS16550 -	/* Enable UART1 clock */ -	func_clks |= BIT21; -	if_clks |= BIT21; -#endif -	v = __raw_readl(CM_ICLKEN1_CORE) | if_clks;	/* Interface clocks on */ -	__raw_writel(v,CM_ICLKEN1_CORE ); -	v = __raw_readl(CM_FCLKEN1_CORE) | func_clks; /* Functional Clocks on */ -	__raw_writel(v, CM_FCLKEN1_CORE); -	delay(1000); - -#ifndef KERNEL_UPDATED -	{ -#define V1 0xffffffff -#define V2 0x00000007 - -		__raw_writel(V1, CM_FCLKEN1_CORE); -		__raw_writel(V2, CM_FCLKEN2_CORE); -		__raw_writel(V1, CM_ICLKEN1_CORE); -		__raw_writel(V1, CM_ICLKEN2_CORE); -	} -#endif -} - -/**************************************** - * Routine: muxSetupUsb0   (ostboot) - * Description: Setup usb muxing - *****************************************/ -void muxSetupUsb0(void) -{ -	volatile uint8   *MuxConfigReg; -	volatile uint32  *otgCtrlReg; - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_PUEN; -	*MuxConfigReg &= (uint8)(~0x1F); - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VP; -	*MuxConfigReg &= (uint8)(~0x1F); - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_VM; -	*MuxConfigReg &= (uint8)(~0x1F); - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_RCV; -	*MuxConfigReg &= (uint8)(~0x1F); - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_TXEN; -	*MuxConfigReg &= (uint8)(~0x1F); - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_SE0; -	*MuxConfigReg &= (uint8)(~0x1F); - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_USB0_DAT; -	*MuxConfigReg &= (uint8)(~0x1F); - -	/* setup for USB VBus detection */ -	otgCtrlReg = (volatile uint32 *)USB_OTG_CTRL; -	*otgCtrlReg |= 0x00040000; /* bit 18 */ -} - -/**************************************** - * Routine: muxSetupUart3   (ostboot) - * Description: Setup uart3 muxing - *****************************************/ -void muxSetupUart3(void) -{ -	volatile uint8 *MuxConfigReg; - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_UART3_TX_IRTX; -	*MuxConfigReg &= (uint8)(~0x1F); - -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_UART3_RX_IRRX; -	*MuxConfigReg &= (uint8)(~0x1F); -} - -/**************************************** - * Routine: muxSetupI2C1   (ostboot) - * Description: Setup i2c muxing - *****************************************/ -void muxSetupI2C1(void) -{ -	volatile unsigned char  *MuxConfigReg; - -	/* I2C1 Clock pin configuration, PIN = M19 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_I2C1_SCL; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* I2C1 Data pin configuration, PIN = L15 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_I2C1_SDA; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* Pull-up required on data line */ -	/* external pull-up already present. */ -	/* *MuxConfigReg |= 0x18 ;*/ /* Mode = 0, PullTypeSel=PU, PullUDEnable=Enabled */ -} - -/**************************************** - * Routine: muxSetupUART1  (ostboot) - * Description: Set up uart1 muxing - *****************************************/ -void muxSetupUART1(void) -{ -	volatile unsigned char  *MuxConfigReg; - -	/* UART1_CTS pin configuration, PIN = D21 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_CTS; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* UART1_RTS pin configuration, PIN = H21 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RTS; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* UART1_TX pin configuration, PIN = L20 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_TX; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* UART1_RX pin configuration, PIN = T21 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_UART1_RX; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -} - -/**************************************** - * Routine: muxSetupLCD   (ostboot) - * Description: Setup lcd muxing - *****************************************/ -void muxSetupLCD(void) -{ -	volatile unsigned char  *MuxConfigReg; - -	/* LCD_D0 pin configuration, PIN = Y7  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D0; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D1 pin configuration, PIN = P10 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D1; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D2 pin configuration, PIN = V8  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D2; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D3 pin configuration, PIN = Y8  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D3; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D4 pin configuration, PIN = W8  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D4; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D5 pin configuration, PIN = R10 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D5; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D6 pin configuration, PIN = Y9  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D6; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D7 pin configuration, PIN = V9  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D7; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D8 pin configuration, PIN = W9  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D8; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D9 pin configuration, PIN = P11 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D9; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D10 pin configuration, PIN = V10 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D10; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D11 pin configuration, PIN = Y10 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D11; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D12 pin configuration, PIN = W10 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D12; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D13 pin configuration, PIN = R11 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D13; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D14 pin configuration, PIN = V11 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D14; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D15 pin configuration, PIN = W11 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D15; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D16 pin configuration, PIN = P12 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D16; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_D17 pin configuration, PIN = R12 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_D17; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_PCLK pin configuration,   PIN = W6   */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_PCLK; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_VSYNC pin configuration,  PIN = V7  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_VSYNC; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_HSYNC pin configuration,  PIN = Y6  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_HSYNC; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* LCD_ACBIAS pin configuration, PIN = W7 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_DSS_ACBIAS; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -} - -/**************************************** - * Routine: muxSetupCamera  (ostboot) - * Description: Setup camera muxing - *****************************************/ -void muxSetupCamera(void) -{ -	volatile unsigned char  *MuxConfigReg; - -	/* CAMERA_RSTZ  pin configuration, PIN = Y16 */ -	/* CAM_RST is connected through the I2C IO expander.*/ -	/* MuxConfigReg = (volatile unsigned char *), CONTROL_PADCONF_SYS_NRESWARM*/ -	/* *MuxConfigReg = 0x00 ; / * Mode = 0, PUPD=Disabled   */ - -	/* CAMERA_XCLK  pin configuration, PIN = U3 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_XCLK; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_LCLK  pin configuration, PIN = V5 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_LCLK; -	*MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_VSYNC pin configuration, PIN = U2 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_VS, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_HSYNC pin configuration, PIN = T3 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_HS, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT0 pin configuration, PIN = T4 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D0, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT1 pin configuration, PIN = V2 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D1, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT2 pin configuration, PIN = V3 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D2, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT3 pin configuration, PIN = U4 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D3, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT4 pin configuration, PIN = W2 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D4, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT5 pin configuration, PIN = V4 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D5, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT6 pin configuration, PIN = W3 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D6, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT7 pin configuration, PIN = Y2 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D7, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT8 pin configuration, PIN = Y4 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D8, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* CAMERA_DAT9 pin configuration, PIN = V6 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_CAM_D9, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -} - -/**************************************** - * Routine: muxSetupMMCSD (ostboot) - * Description: set up MMC muxing - *****************************************/ -void muxSetupMMCSD(void) -{ -	volatile unsigned char  *MuxConfigReg; - -	/* SDMMC_CLKI pin configuration,  PIN = H15 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKI, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SDMMC_CLKO pin configuration,  PIN = G19 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CLKO, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SDMMC_CMD pin configuration,   PIN = H18 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -	/* External pull-ups are present. */ -	/* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */ - -	/* SDMMC_DAT0 pin configuration,  PIN = F20 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT0, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -	/* External pull-ups are present. */ -	/* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */ - -	/* SDMMC_DAT1 pin configuration,  PIN = H14 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT1, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -	/* External pull-ups are present. */ -	/* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */ - -	/* SDMMC_DAT2 pin configuration,  PIN = E19 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT2, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -	/* External pull-ups are present. */ -	/* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */ - -	/* SDMMC_DAT3 pin configuration,  PIN = D19 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT3, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -	/* External pull-ups are present. */ -	/* *MuxConfigReg |= 0x18 ; #/ PullUDEnable=Enabled, PullTypeSel=PU */ - -	/* SDMMC_DDIR0 pin configuration, PIN = F19 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR0, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SDMMC_DDIR1 pin configuration, PIN = E20 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR1, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SDMMC_DDIR2 pin configuration, PIN = F18 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR2, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SDMMC_DDIR3 pin configuration, PIN = E18 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_DAT_DIR3, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SDMMC_CDIR pin configuration,  PIN = G18 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MMC_CMD_DIR, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* MMC_CD pin configuration,      PIN = B3  ---2420IP ONLY---*/ -	/* MMC_CD for 2422IP=K1 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SDRC_A14, -				   *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */ - -	/* MMC_WP pin configuration,      PIN = B4  */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SDRC_A13, -				   *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */ -} - -/****************************************** - * Routine: muxSetupTouchScreen (ostboot) - * Description:  Set up touch screen muxing - *******************************************/ -void muxSetupTouchScreen(void) -{ -	volatile unsigned char  *MuxConfigReg; - -	/* SPI1_CLK pin configuration,  PIN = U18 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_CLK, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SPI1_MOSI pin configuration, PIN = V20 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SIMO, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SPI1_MISO pin configuration, PIN = T18 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_SOMI, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* SPI1_nCS0 pin configuration, PIN = U19 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_SPI1_NCS0, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ - -	/* PEN_IRQ pin configuration,   PIN = P20 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_MCBSP1_FSR, -				   *MuxConfigReg = 0x03 ; /* Mode = 3, PUPD=Disabled */ -} - -/**************************************** - * Routine: muxSetupHDQ (ostboot) - * Description: setup 1wire mux - *****************************************/ -void muxSetupHDQ(void) -{ -	volatile unsigned char  *MuxConfigReg; - -	/* HDQ_SIO pin configuration,  PIN = N18 */ -	MuxConfigReg = (volatile unsigned char *)CONTROL_PADCONF_HDQ_SIO, -				   *MuxConfigReg = 0x00 ; /* Mode = 0, PUPD=Disabled */ -} - -/*************************************************************** - * Routine: muxSetupGPMC (ostboot) - * Description: Configures balls which cam up in protected mode - ***************************************************************/ -void muxSetupGPMC(void) -{ -	volatile uint8 *MuxConfigReg; -	volatile unsigned int *MCR = (volatile unsigned int *)0x4800008C; - -	/* gpmc_io_dir */ -	*MCR = 0x19000000; - -	/* NOR FLASH CS0 */ -	/* signal - Gpmc_clk; pin - J4; offset - 0x0088; mode - 0; Byte-3	Pull/up - N/A */ -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_D2_BYTE3, -				   *MuxConfigReg = 0x00 ; - -	/* signal - Gpmc_iodir; pin - n2; offset - 0x008C; mode - 1; Byte-3	Pull/up - N/A */ -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE3, -				   *MuxConfigReg = 0x01 ; - -	/* MPDB(Multi Port Debug Port) CS1 */ -	/* signal - gpmc_ncs1; pin - N8; offset - 0x008C; mode - 0; Byte-1	Pull/up - N/A */ -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE1, -				   *MuxConfigReg = 0x00 ; - -	/* signal - Gpmc_ncs2; pin - E2; offset - 0x008C; mode - 0; Byte-2	Pull/up - N/A */ -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_GPMC_NCS0_BYTE2, -				   *MuxConfigReg = 0x00 ; -} - -/**************************************************************** - * Routine: muxSetupSDRC  (ostboot) - * Description: Configures balls which come up in protected mode - ****************************************************************/ -void muxSetupSDRC(void) -{ -	volatile uint8 *MuxConfigReg; - -	/* signal - sdrc_ncs1; pin - C12; offset - 0x00A0; mode - 0; Byte-1	Pull/up - N/A */ -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_NCS0_BYTE1, -				   *MuxConfigReg = 0x00 ; - -	/* signal - sdrc_a12; pin - D11; offset - 0x0030; mode - 0; Byte-2	Pull/up - N/A */ -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_A14_BYTE2, -				   *MuxConfigReg = 0x00 ; - -	/* signal - sdrc_cke1; pin - B13; offset - 0x00A0; mode - 0; Byte-3	Pull/up - N/A */ -	MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_NCS0_BYTE3, -				   *MuxConfigReg = 0x00; - -	if (get_cpu_type() == CPU_2422) { -		MuxConfigReg = (volatile uint8 *)CONTROL_PADCONF_SDRC_A14_BYTE0, -					   *MuxConfigReg = 0x1b; -	} -} - -/***************************************************************************** - * Routine: update_mux() - * Description: Update balls which are different beween boards.  All should be - *              updated to match functionaly.  However, I'm only updating ones - *              which I'll be using for now.  When power comes into play they - *              all need updating. - *****************************************************************************/ -void update_mux(u32 btype,u32 mtype) -{ -	u32 cpu, base = OMAP2420_CTRL_BASE; -	cpu = get_cpu_type(); - -	if (btype == BOARD_H4_MENELAUS) { -		if (cpu == CPU_2420) { -			/* PIN = B3,  GPIO.0->KBR5,      mode 3,  (pun?),-DO-*/ -			__raw_writeb(0x3, base+0x30); -			/* PIN = B13, GPIO.38->KBC6,     mode 3,  (pun?)-DO-*/ -			__raw_writeb(0x3, base+0xa3); -			/* PIN = F1, GPIO.25->HSUSBxx    mode 3,  (for external HS USB)*/ -			/* PIN = H1, GPIO.26->HSUSBxx    mode 3,  (for external HS USB)*/ -			/* PIN = K1, GPMC_ncs6           mode 0,  (on board nand access)*/ -			/* PIN = L2, GPMC_ncs67          mode 0,  (for external HS USB)*/ -			/* PIN = M1 (HSUSBOTG) */ -			/* PIN = P1, GPIO.35->MEN_POK    mode 3,  (menelaus powerok)-DO-*/ -			__raw_writeb(0x3, base+0x9d); -			/* PIN = U32, (WLAN_CLKREQ) */ -			/* PIN = Y11, WLAN */ -			/* PIN = AA4, GPIO.15->KBC2,     mode 3,  -DO- */ -			__raw_writeb(0x3, base+0xe7); -			/* PIN = AA8, mDOC */ -			/* PIN = AA10, BT */ -			/* PIN = AA13, WLAN */ -			/* PIN = M18 GPIO.96->MMC2_WP    mode 3   -DO- */ -			__raw_writeb(0x3, base+0x10e); -			/* PIN = N19 GPIO.98->WLAN_INT   mode 3   -DO- */ -			__raw_writeb(0x3, base+0x110); -			/* PIN = J15 HHUSB */ -			/* PIN = H19 HSUSB */ -			/* PIN = W13, P13, R13, W16 ... */ -			/* PIN = V12 GPIO.25->I2C_CAMEN  mode 3   -DO- */ -			__raw_writeb(0x3, base+0xde); -			/* PIN = W19 sys_nirq->MENELAUS_INT mode 0 -DO- */ -			__raw_writeb(0x0, base+0x12c); -			/* PIN = AA17->sys_clkreq        mode 0   -DO- */ -			__raw_writeb(0x0, base+0x136); -		} else if (cpu == CPU_2422) { -			/* PIN = B3,  GPIO.0->nc,        mode 3,  set above (pun?)*/ -			/* PIN = B13, GPIO.cke1->nc,     mode 0,  set above, (pun?)*/ -			/* PIN = F1, GPIO.25->HSUSBxx    mode 3,  (for external HS USB)*/ -			/* PIN = H1, GPIO.26->HSUSBxx    mode 3,  (for external HS USB)*/ -			/* PIN = K1, GPMC_ncs6           mode 0,  (on board nand access)*/ -			__raw_writeb(0x0, base+0x92); -			/* PIN = L2, GPMC_ncs67          mode 0,  (for external HS USB)*/ -			/* PIN = M1 (HSUSBOTG) */ -			/* PIN = P1, GPIO.35->MEN_POK    mode 3,  (menelaus powerok)-DO-*/ -			__raw_writeb(0x3, base+0x10c); -			/* PIN = U32, (WLAN_CLKREQ) */ -			/* PIN = AA4, GPIO.15->KBC2,     mode 3,  -DO- */ -			__raw_writeb(0x3, base+0x30); -			/* PIN = AA8, mDOC */ -			/* PIN = AA10, BT */ -			/* PIN = AA12, WLAN */ -			/* PIN = M18 GPIO.96->MMC2_WP    mode 3   -DO- */ -			__raw_writeb(0x3, base+0x10e); -			/* PIN = N19 GPIO.98->WLAN_INT   mode 3   -DO- */ -			__raw_writeb(0x3, base+0x110); -			/* PIN = J15 HHUSB */ -			/* PIN = H19 HSUSB */ -			/* PIN = W13, P13, R13, W16 ... */ -			/* PIN = V12 GPIO.25->I2C_CAMEN  mode 3   -DO- */ -			__raw_writeb(0x3, base+0xde); -			/* PIN = W19 sys_nirq->MENELAUS_INT mode 0 -DO- */ -			__raw_writeb(0x0, base+0x12c); -			/* PIN = AA17->sys_clkreq        mode 0   -DO- */ -			__raw_writeb(0x0, base+0x136); -		} - -	} else if (btype == BOARD_H4_SDP) { -		if (cpu == CPU_2420) { -			/* PIN = B3,  GPIO.0->nc         mode 3,  set above (pun?)*/ -			/* PIN = B13, GPIO.cke1->nc,     mode 0,  set above, (pun?)*/ -			/* Pin = Y11 VLNQ */ -			/* Pin = AA4 VLNQ */ -			/* Pin = AA6 VLNQ */ -			/* Pin = AA8 VLNQ */ -			/* Pin = AA10 VLNQ */ -			/* Pin = AA12 VLNQ */ -			/* PIN = M18 GPIO.96->KBR5       mode 3   -DO- */ -			__raw_writeb(0x3, base+0x10e); -			/* PIN = N19 GPIO.98->KBC6       mode 3   -DO- */ -			__raw_writeb(0x3, base+0x110); -			/* PIN = J15 MDOC_nDMAREQ */ -			/* PIN = H19 GPIO.100->KBC2      mode 3   -DO- */ -			__raw_writeb(0x3, base+0x114); -			/* PIN = W13, V12, P13, R13, W19, W16 ... */ -			/* PIN = AA17 sys_clkreq->bt_clk_req  mode 0  */ -		} else if (cpu == CPU_2422) { -			/* PIN = B3,  GPIO.0->MMC_CD,    mode 3,  set above */ -			/* PIN = B13, GPIO.38->wlan_int, mode 3,  (pun?)*/ -			/* Pin = Y11 VLNQ */ -			/* Pin = AA4 VLNQ */ -			/* Pin = AA6 VLNQ */ -			/* Pin = AA8 VLNQ */ -			/* Pin = AA10 VLNQ */ -			/* Pin = AA12 VLNQ */ -			/* PIN = M18 GPIO.96->KBR5       mode 3   -DO- */ -			__raw_writeb(0x3, base+0x10e); -			/* PIN = N19 GPIO.98->KBC6       mode 3   -DO- */ -			__raw_writeb(0x3, base+0x110); -			/* PIN = J15 MDOC_nDMAREQ */ -			/* PIN = H19 GPIO.100->KBC2      mode 3   -DO- */ -			__raw_writeb(0x3, base+0x114); -			/* PIN = W13, V12, P13, R13, W19, W16 ... */ -			/* PIN = AA17 sys_clkreq->bt_clk_req  mode 0 */ -		} -	} -} - -#ifdef CONFIG_CMD_NET -int board_eth_init(bd_t *bis) -{ -	int rc = 0; -#ifdef CONFIG_LAN91C96 -	rc = lan91c96_initialize(0, CONFIG_LAN91C96_BASE); -#endif -	return rc; -} -#endif diff --git a/board/ti/omap2420h4/sys_info.c b/board/ti/omap2420h4/sys_info.c deleted file mode 100644 index b12011e04..000000000 --- a/board/ti/omap2420h4/sys_info.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - * (C) Copyright 2004 - * Texas Instruments, <www.ti.com> - * Richard Woodruff <r-woodruff2@ti.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/arch/omap2420.h> -#include <asm/io.h> -#include <asm/arch/bits.h> -#include <asm/arch/mem.h>  /* get mem tables */ -#include <asm/arch/sys_proto.h> -#include <asm/arch/sys_info.h> -#include <i2c.h> - -/************************************************************************** - * get_prod_id() - get id info from chips - ***************************************************************************/ -static u32 get_prod_id(void) -{ -	u32 p; -	p = __raw_readl(PRODUCTION_ID); /* get production ID */ -	return((p & CPU_242X_PID_MASK) >> 16); -} - -/************************************************************************** - * get_cpu_type() - low level get cpu type - * - no C globals yet. - * - just looking to say if this is a 2422 or 2420 or ... - * - to start with we will look at switch settings.. - * - 2422 id's same as 2420 for ES1 will rely on H4 board characteristics - *   (mux for 2420, non-mux for 2422). - ***************************************************************************/ -u32 get_cpu_type(void) -{ -	u32 v; - -	switch(get_prod_id()){ -		case 1:;/* 2420 */ -		case 2: return(CPU_2420); break; /* 2420 pop */ -		case 4: return(CPU_2422); break; -		case 8: return(CPU_2423); break; -		default: break;  /* early 2420/2422's unmarked */ -	} - -	v = __raw_readl(TAP_IDCODE_REG); -	v &= CPU_24XX_ID_MASK; -	if (v == CPU_2420_CHIPID) {	  /* currently 2420 and 2422 have same id */ -		if (is_gpmc_muxed() == GPMC_MUXED)	  /* if mux'ed */ -			return(CPU_2420); -		else -			return(CPU_2422); -	} else -		return(CPU_2420); /* don't know, say 2420 */ -} - -/****************************************** - * get_cpu_rev(void) - extract version info - ******************************************/ -u32 get_cpu_rev(void) -{ -	u32 v; -	v = __raw_readl(TAP_IDCODE_REG); -	v = v >> 28; -	return(v+1);  /* currently 2422 and 2420 match up */ -} -/**************************************************** - * is_mem_sdr() - return 1 if mem type in use is SDR - ****************************************************/ -u32 is_mem_sdr(void) -{ -	volatile u32 *burst = (volatile u32 *)(SDRC_MR_0+SDRC_CS0_OSET); -	if(*burst == H4_2420_SDRC_MR_0_SDR) -		return(1); -	return(0); -} - -/*********************************************************** - * get_mem_type() - identify type of mDDR part used. - * 2422 uses stacked DDR, 2 parts CS0/CS1. - * 2420 may have 1 or 2, no good way to know...only init 1... - * when eeprom data is up we can select 1 more. - *************************************************************/ -u32 get_mem_type(void) -{ -	u32 cpu, sdr = is_mem_sdr(); - -	cpu = get_cpu_type(); -	if (cpu == CPU_2422 || cpu == CPU_2423) -		return(DDR_STACKED); - -	if(get_prod_id() == 0x2) -		return(XDR_POP); - -	if (get_board_type() == BOARD_H4_MENELAUS) -		if(sdr) -			return(SDR_DISCRETE); -		else -			return(DDR_COMBO); -	else -		if(sdr) /* SDP + SDR kit */ -			return(SDR_DISCRETE); -		else -			return(DDR_DISCRETE); /* origional SDP */ -} - -/*********************************************************************** - * get_cs0_size() - get size of chip select 0/1 - ************************************************************************/ -u32 get_sdr_cs_size(u32 offset) -{ -	u32 size; -	size = __raw_readl(SDRC_MCFG_0+offset) >> 8; /* get ram size field */ -	size &= 0x2FF;   /* remove unwanted bits */ -	size *= SZ_2M;   /* find size in MB */ -	return(size); -} - -/*********************************************************************** - * get_board_type() - get board type based on current production stats. - *  --- NOTE: 2 I2C EEPROMs will someday be populated with proper info. - *      when they are available we can get info from there.  This should - *      be correct of all known boards up until today. - ************************************************************************/ -u32 get_board_type(void) -{ -	if (i2c_probe(I2C_MENELAUS) == 0) -		return(BOARD_H4_MENELAUS); -	else -		return(BOARD_H4_SDP); -} - -/****************************************************************** - * get_sysboot_value() - get init word settings (dip switch on h4) - ******************************************************************/ -inline u32 get_sysboot_value(void) -{ -	return(0x00000FFF & __raw_readl(CONTROL_STATUS)); -} - -/*************************************************************************** - *  get_gpmc0_base() - Return current address hardware will be - *     fetching from. The below effectively gives what is correct, its a bit - *   mis-leading compared to the TRM.  For the most general case the mask - *   needs to be also taken into account this does work in practice. - *   - for u-boot we currently map: - *       -- 0 to nothing, - *       -- 4 to flash - *       -- 8 to enent - *       -- c to wifi - ****************************************************************************/ -u32 get_gpmc0_base(void) -{ -	u32 b; - -	b = __raw_readl(GPMC_CONFIG7_0); -	b &= 0x1F;	 /* keep base [5:0] */ -	b = b << 24; /* ret 0x0b000000 */ -	return(b); -} - -/***************************************************************** - *  is_gpmc_muxed() - tells if address/data lines are multiplexed - *****************************************************************/ -u32 is_gpmc_muxed(void) -{ -	u32 mux; -	mux = get_sysboot_value(); -	if ((mux & (BIT0 | BIT1 | BIT2 | BIT3)) == (BIT0 | BIT2 | BIT3)) -		return(GPMC_MUXED); /* NAND Boot mode */ -	if (mux & BIT1)	   /* if mux'ed */ -		return(GPMC_MUXED); -	else -		return(GPMC_NONMUXED); -} - -/************************************************************************ - *  get_gpmc0_type() - read sysboot lines to see type of memory attached - ************************************************************************/ -u32 get_gpmc0_type(void) -{ -	u32 type; -	type = get_sysboot_value(); -	if ((type & (BIT3|BIT2)) == (BIT3|BIT2)) -		return(TYPE_NAND); -	else -		return(TYPE_NOR); -} - -/******************************************************************* - * get_gpmc0_width() - See if bus is in x8 or x16 (mainly for nand) - *******************************************************************/ -u32 get_gpmc0_width(void) -{ -	u32 width; -	width = get_sysboot_value(); -	if ((width & 0xF) == (BIT3|BIT2)) -		return(WIDTH_8BIT); -	else -		return(WIDTH_16BIT); -} - -/********************************************************************* - * wait_on_value() - common routine to allow waiting for changes in - *   volatile regs. - *********************************************************************/ -u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound) -{ -	u32 i = 0, val; -	do { -		++i; -		val = __raw_readl(read_addr) & read_bit_mask; -		if (val == match_value) -			return(1); -		if (i==bound) -			return(0); -	} while (1); -} - -/********************************************************************* - *  display_board_info() - print banner with board info. - *********************************************************************/ -void display_board_info(u32 btype) -{ -	static const char cpu_2420 [] = "2420";   /* cpu type */ -	static const char cpu_2422 [] = "2422"; -	static const char cpu_2423 [] = "2423"; -	static const char db_men [] = "Menelaus"; /* board type */ -	static const char db_ip [] = "IP"; -	static const char mem_sdr [] = "mSDR";    /* memory type */ -	static const char mem_ddr [] = "mDDR"; -	static const char t_tst [] = "TST";	    /* security level */ -	static const char t_emu [] = "EMU"; -	static const char t_hs [] = "HS"; -	static const char t_gp [] = "GP"; -	static const char unk [] = "?"; - -	const char *cpu_s, *db_s, *mem_s, *sec_s; -	u32 cpu, rev, sec; - -	rev = get_cpu_rev(); -	cpu = get_cpu_type(); -	sec = get_device_type(); - -	if(is_mem_sdr()) -		mem_s = mem_sdr; -	else -		mem_s = mem_ddr; - -	if(cpu == CPU_2423) -		cpu_s = cpu_2423; -	else if (cpu == CPU_2422) -		cpu_s = cpu_2422; -	else -		cpu_s = cpu_2420; - -	if(btype ==  BOARD_H4_MENELAUS) -		db_s = db_men; -	else -		db_s = db_ip; - -	switch(sec){ -		case TST_DEVICE: sec_s = t_tst; break; -		case EMU_DEVICE: sec_s = t_emu; break; -		case HS_DEVICE:  sec_s = t_hs; break; -		case GP_DEVICE:  sec_s = t_gp; break; -		default: sec_s = unk; -	} - -	printf("OMAP%s-%s revision %d\n", cpu_s, sec_s, rev-1); -	printf("TI H4 SDP Base Board + %s Daughter Board + %s \n", db_s, mem_s); -} - -/************************************************************************* - * get_board_rev() - setup to pass kernel board revision information - *          0 = 242x IP platform (first 2xx boards) - *          1 = 242x Menelaus platfrom. - *************************************************************************/ -u32 get_board_rev(void) -{ -	u32 rev = 0; -	u32 btype = get_board_type(); - -	if (btype == BOARD_H4_MENELAUS){ -		rev = 1; -	} -	return(rev); -} - -/******************************************************** - *  get_base(); get upper addr of current execution - *******************************************************/ -u32 get_base(void) -{ -	u32  val; -	__asm__ __volatile__("mov %0, pc \n" : "=r" (val) : : "memory"); -	val &= 0xF0000000; -	val >>= 28; -	return(val); -} - -/******************************************************** - *  get_base2(); get 2upper addr of current execution - *******************************************************/ -u32 get_base2(void) -{ -	u32  val; -	__asm__ __volatile__("mov %0, pc \n" : "=r" (val) : : "memory"); -	val &= 0xFF000000; -	val >>= 24; -	return(val); -} - -/******************************************************** - *  running_in_flash() - tell if currently running in - *   flash. - *******************************************************/ -u32 running_in_flash(void) -{ -	if (get_base() < 4) -		return(1);  /* in flash */ -	return(0); /* running in SRAM or SDRAM */ -} - -/******************************************************** - *  running_in_sram() - tell if currently running in - *   sram. - *******************************************************/ -u32 running_in_sram(void) -{ -	if (get_base() == 4) -		return(1);  /* in SRAM */ -	return(0); /* running in FLASH or SDRAM */ -} -/******************************************************** - *  running_in_sdram() - tell if currently running in - *   flash. - *******************************************************/ -u32 running_in_sdram(void) -{ -	if (get_base() > 4) -		return(1);  /* in sdram */ -	return(0); /* running in SRAM or FLASH */ -} - -/************************************************************* - *  running_from_internal_boot() - am I a signed NOR image. - *************************************************************/ -u32 running_from_internal_boot(void) -{ -	u32 v, base; - -	v = get_sysboot_value() & BIT3; -	base = get_base2(); -	/* if running at mask rom flash address and -	 * sysboot3 says this was an internal boot -	 */ -	if ((base == 0x08) && v) -		return(1); -	else -		return(0); -} - -/************************************************************* - *  get_device_type(): tell if GP/HS/EMU/TST - *************************************************************/ -u32 get_device_type(void) -{ -	int mode; -	mode = __raw_readl(CONTROL_STATUS) & (BIT10|BIT9|BIT8); -	return(mode >>= 8); -} diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c index 46db1bfe6..90046e896 100644 --- a/board/ti/omap5_uevm/evm.c +++ b/board/ti/omap5_uevm/evm.c @@ -71,22 +71,26 @@ int misc_init_r(void)  void set_muxconf_regs_essential(void)  { -	do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_essential, +	do_set_mux((*ctrl)->control_padconf_core_base, +		   core_padconf_array_essential,  		   sizeof(core_padconf_array_essential) /  		   sizeof(struct pad_conf_entry)); -	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_essential, +	do_set_mux((*ctrl)->control_padconf_wkup_base, +		   wkup_padconf_array_essential,  		   sizeof(wkup_padconf_array_essential) /  		   sizeof(struct pad_conf_entry));  }  void set_muxconf_regs_non_essential(void)  { -	do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential, +	do_set_mux((*ctrl)->control_padconf_core_base, +		   core_padconf_array_non_essential,  		   sizeof(core_padconf_array_non_essential) /  		   sizeof(struct pad_conf_entry)); -	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_non_essential, +	do_set_mux((*ctrl)->control_padconf_wkup_base, +		   wkup_padconf_array_non_essential,  		   sizeof(wkup_padconf_array_non_essential) /  		   sizeof(struct pad_conf_entry));  } diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c index 2bbe392d8..90ae29e7c 100644 --- a/board/ti/panda/panda.c +++ b/board/ti/panda/panda.c @@ -24,7 +24,7 @@  #include <common.h>  #include <asm/arch/sys_proto.h>  #include <asm/arch/mmc_host_def.h> -#include <asm/arch/clocks.h> +#include <asm/arch/clock.h>  #include <asm/arch/gpio.h>  #include <asm/gpio.h> @@ -139,16 +139,18 @@ int misc_init_r(void)  void set_muxconf_regs_essential(void)  { -	do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_essential, +	do_set_mux((*ctrl)->control_padconf_core_base, +		   core_padconf_array_essential,  		   sizeof(core_padconf_array_essential) /  		   sizeof(struct pad_conf_entry)); -	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_essential, +	do_set_mux((*ctrl)->control_padconf_wkup_base, +		   wkup_padconf_array_essential,  		   sizeof(wkup_padconf_array_essential) /  		   sizeof(struct pad_conf_entry));  	if (omap_revision() >= OMAP4460_ES1_0) -		do_set_mux(CONTROL_PADCONF_WKUP, +		do_set_mux((*ctrl)->control_padconf_wkup_base,  				 wkup_padconf_array_essential_4460,  				 sizeof(wkup_padconf_array_essential_4460) /  				 sizeof(struct pad_conf_entry)); @@ -156,27 +158,29 @@ void set_muxconf_regs_essential(void)  void set_muxconf_regs_non_essential(void)  { -	do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential, +	do_set_mux((*ctrl)->control_padconf_core_base, +		   core_padconf_array_non_essential,  		   sizeof(core_padconf_array_non_essential) /  		   sizeof(struct pad_conf_entry));  	if (omap_revision() < OMAP4460_ES1_0) -		do_set_mux(CONTROL_PADCONF_CORE, +		do_set_mux((*ctrl)->control_padconf_core_base,  				core_padconf_array_non_essential_4430,  				sizeof(core_padconf_array_non_essential_4430) /  				sizeof(struct pad_conf_entry));  	else -		do_set_mux(CONTROL_PADCONF_CORE, +		do_set_mux((*ctrl)->control_padconf_core_base,  				core_padconf_array_non_essential_4460,  				sizeof(core_padconf_array_non_essential_4460) /  				sizeof(struct pad_conf_entry)); -	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_non_essential, +	do_set_mux((*ctrl)->control_padconf_wkup_base, +		   wkup_padconf_array_non_essential,  		   sizeof(wkup_padconf_array_non_essential) /  		   sizeof(struct pad_conf_entry));  	if (omap_revision() < OMAP4460_ES1_0) -		do_set_mux(CONTROL_PADCONF_WKUP, +		do_set_mux((*ctrl)->control_padconf_wkup_base,  				wkup_padconf_array_non_essential_4430,  				sizeof(wkup_padconf_array_non_essential_4430) /  				sizeof(struct pad_conf_entry)); diff --git a/board/ti/sdp4430/sdp.c b/board/ti/sdp4430/sdp.c index 4c1a4f7e7..5dd1ba3cb 100644 --- a/board/ti/sdp4430/sdp.c +++ b/board/ti/sdp4430/sdp.c @@ -72,16 +72,18 @@ int misc_init_r(void)  void set_muxconf_regs_essential(void)  { -	do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_essential, +	do_set_mux((*ctrl)->control_padconf_core_base, +		   core_padconf_array_essential,  		   sizeof(core_padconf_array_essential) /  		   sizeof(struct pad_conf_entry)); -	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_essential, +	do_set_mux((*ctrl)->control_padconf_wkup_base, +		   wkup_padconf_array_essential,  		   sizeof(wkup_padconf_array_essential) /  		   sizeof(struct pad_conf_entry));  	if (omap_revision() >= OMAP4460_ES1_0) -		do_set_mux(CONTROL_PADCONF_WKUP, +		do_set_mux((*ctrl)->control_padconf_wkup_base,  				 wkup_padconf_array_essential_4460,  				 sizeof(wkup_padconf_array_essential_4460) /  				 sizeof(struct pad_conf_entry)); @@ -89,16 +91,18 @@ void set_muxconf_regs_essential(void)  void set_muxconf_regs_non_essential(void)  { -	do_set_mux(CONTROL_PADCONF_CORE, core_padconf_array_non_essential, +	do_set_mux((*ctrl)->control_padconf_core_base, +		   core_padconf_array_non_essential,  		   sizeof(core_padconf_array_non_essential) /  		   sizeof(struct pad_conf_entry)); -	do_set_mux(CONTROL_PADCONF_WKUP, wkup_padconf_array_non_essential, +	do_set_mux((*ctrl)->control_padconf_wkup_base, +		   wkup_padconf_array_non_essential,  		   sizeof(wkup_padconf_array_non_essential) /  		   sizeof(struct pad_conf_entry));  	if (omap_revision() < OMAP4460_ES1_0) { -		do_set_mux(CONTROL_PADCONF_WKUP, +		do_set_mux((*ctrl)->control_padconf_wkup_base,  			wkup_padconf_array_non_essential_4430,  			sizeof(wkup_padconf_array_non_essential_4430) /  			sizeof(struct pad_conf_entry)); diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c index 7adb52405..4759b167a 100644 --- a/board/ti/ti814x/evm.c +++ b/board/ti/ti814x/evm.c @@ -149,6 +149,15 @@ static const struct ddr_data evm_ddr2_data = {  void s_init(void)  {  #ifdef CONFIG_SPL_BUILD +	/* +	 * Save the boot parameters passed from romcode. +	 * We cannot delay the saving further than this, +	 * to prevent overwrites. +	 */ +#ifdef CONFIG_SPL_BUILD +	save_omap_boot_params(); +#endif +  	/* WDT1 is already running when the bootloader gets control  	 * Disable it to avoid "random" resets  	 */ diff --git a/board/ttcontrol/vision2/imximage_hynix.cfg b/board/ttcontrol/vision2/imximage_hynix.cfg index c1de94fa1..64bddbbc2 100644 --- a/board/ttcontrol/vision2/imximage_hynix.cfg +++ b/board/ttcontrol/vision2/imximage_hynix.cfg @@ -23,7 +23,7 @@   * Foundation Inc. 51 Franklin Street Fifth Floor Boston,   * MA 02110-1301 USA   * - * Refer docs/README.imxmage for more details about how-to configure + * Refer doc/README.imximage for more details about how-to configure   * and create imximage boot image   *   * The syntax is taken as close as possible with the kwbimage diff --git a/board/wandboard/README b/board/wandboard/README index e0b0b3302..ce83bbe4c 100644 --- a/board/wandboard/README +++ b/board/wandboard/README @@ -14,12 +14,12 @@ Building U-boot for Wandboard  To build U-Boot for the Wandboard Dual Lite version: -$ make wanboard_dl_config +$ make wandboard_dl_config  $ make  To build U-Boot for the Wandboard Solo version: -$ make wanboard_solo_config +$ make wandboard_solo_config  $ make  Flashing U-boot into the SD card diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c index bb983528b..5666cbf26 100644 --- a/board/wandboard/wandboard.c +++ b/board/wandboard/wandboard.c @@ -10,9 +10,11 @@   */  #include <asm/arch/clock.h> +#include <asm/arch/crm_regs.h>  #include <asm/arch/iomux.h>  #include <asm/arch/imx-regs.h>  #include <asm/arch/mx6-pins.h> +#include <asm/arch/mxc_hdmi.h>  #include <asm/arch/sys_proto.h>  #include <asm/gpio.h>  #include <asm/imx-common/iomux-v3.h> @@ -21,9 +23,11 @@  #include <asm/sizes.h>  #include <common.h>  #include <fsl_esdhc.h> +#include <ipu_pixfmt.h>  #include <mmc.h>  #include <miiphy.h>  #include <netdev.h> +#include <linux/fb.h>  DECLARE_GLOBAL_DATA_PTR; @@ -206,6 +210,88 @@ int board_phy_config(struct phy_device *phydev)  	return 0;  } +#if defined(CONFIG_VIDEO_IPUV3) +static void enable_hdmi(void) +{ +	struct hdmi_regs *hdmi	= (struct hdmi_regs *)HDMI_ARB_BASE_ADDR; +	u8 reg; +	reg = readb(&hdmi->phy_conf0); +	reg |= HDMI_PHY_CONF0_PDZ_MASK; +	writeb(reg, &hdmi->phy_conf0); + +	udelay(3000); +	reg |= HDMI_PHY_CONF0_ENTMDS_MASK; +	writeb(reg, &hdmi->phy_conf0); +	udelay(3000); +	reg |= HDMI_PHY_CONF0_GEN2_TXPWRON_MASK; +	writeb(reg, &hdmi->phy_conf0); +	writeb(HDMI_MC_PHYRSTZ_ASSERT, &hdmi->mc_phyrstz); +} + +static struct fb_videomode const hdmi = { +	.name           = "HDMI", +	.refresh        = 60, +	.xres           = 1024, +	.yres           = 768, +	.pixclock       = 15385, +	.left_margin    = 220, +	.right_margin   = 40, +	.upper_margin   = 21, +	.lower_margin   = 7, +	.hsync_len      = 60, +	.vsync_len      = 10, +	.sync           = FB_SYNC_EXT, +	.vmode          = FB_VMODE_NONINTERLACED +}; + +int board_video_skip(void) +{ +	int ret; + +	ret = ipuv3_fb_init(&hdmi, 0, IPU_PIX_FMT_RGB24); + +	if (ret) +		printf("HDMI cannot be configured: %d\n", ret); + +	enable_hdmi(); + +	return ret; +} + +static void setup_display(void) +{ +	struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR; +	struct hdmi_regs *hdmi	= (struct hdmi_regs *)HDMI_ARB_BASE_ADDR; +	int reg; + +	/* Turn on IPU clock */ +	reg = readl(&mxc_ccm->CCGR3); +	reg |= MXC_CCM_CCGR3_IPU1_IPU_DI0_OFFSET; +	writel(reg, &mxc_ccm->CCGR3); + +	/* Turn on HDMI PHY clock */ +	reg = readl(&mxc_ccm->CCGR2); +	reg |=  MXC_CCM_CCGR2_HDMI_TX_IAHBCLK_MASK +		| MXC_CCM_CCGR2_HDMI_TX_ISFRCLK_MASK; +	writel(reg, &mxc_ccm->CCGR2); + +	/* clear HDMI PHY reset */ +	writeb(HDMI_MC_PHYRSTZ_DEASSERT, &hdmi->mc_phyrstz); + +	reg = readl(&mxc_ccm->chsccdr); +	reg &= ~(MXC_CCM_CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK +		| MXC_CCM_CHSCCDR_IPU1_DI0_PODF_MASK +		| MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_MASK); +	reg |= (CHSCCDR_CLK_SEL_LDB_DI0 +		<< MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_OFFSET) +	      | (CHSCCDR_PODF_DIVIDE_BY_3 +		<< MXC_CCM_CHSCCDR_IPU1_DI0_PODF_OFFSET) +	      | (CHSCCDR_IPU_PRE_CLK_540M_PFD +		<< MXC_CCM_CHSCCDR_IPU1_DI0_PRE_CLK_SEL_OFFSET); +	writel(reg, &mxc_ccm->chsccdr); +} +#endif /* CONFIG_VIDEO_IPUV3 */ +  int board_eth_init(bd_t *bis)  {  	int ret; @@ -222,9 +308,21 @@ int board_eth_init(bd_t *bis)  int board_early_init_f(void)  {  	setup_iomux_uart(); +#if defined(CONFIG_VIDEO_IPUV3) +	setup_display(); +#endif  	return 0;  } +/* + * Do not overwrite the console + * Use always serial for U-Boot console + */ +int overwrite_console(void) +{ +	return 1; +} +  #ifdef CONFIG_CMD_BMODE  static const struct boot_mode board_boot_modes[] = {  	/* 4 bit bus width */ diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c index befbb3a3e..2f5f20ea3 100644 --- a/board/xilinx/microblaze-generic/microblaze-generic.c +++ b/board/xilinx/microblaze-generic/microblaze-generic.c @@ -31,12 +31,17 @@  #include <asm/processor.h>  #include <asm/microblaze_intc.h>  #include <asm/asm.h> +#include <asm/gpio.h> + +#ifdef CONFIG_XILINX_GPIO +static int reset_pin = -1; +#endif  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  { -#ifdef CONFIG_SYS_GPIO_0 -	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = -	    ++(*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR))); +#ifdef CONFIG_XILINX_GPIO +	if (reset_pin != -1) +		gpio_direction_output(reset_pin, 1);  #endif  #ifdef CONFIG_XILINX_TB_WATCHDOG @@ -52,8 +57,10 @@ int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])  int gpio_init (void)  { -#ifdef CONFIG_SYS_GPIO_0 -	*((unsigned long *)(CONFIG_SYS_GPIO_0_ADDR)) = 0xFFFFFFFF; +#ifdef CONFIG_XILINX_GPIO +	reset_pin = gpio_alloc(CONFIG_SYS_GPIO_0_ADDR, "reset", 1); +	if (reset_pin != -1) +		gpio_request(reset_pin, "reset_pin");  #endif  	return 0;  } |