U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
May 2009
- 178 participants
- 436 discussions

07 Aug '09
Here are some (hopefully final) changes to the omap3 cleanup.
changes since v2:
- split cs-config into 2 patches (patch 1/2)
- remove (accidentally missed) typedefs (patch 3)
- based on arm/next (zoom2 ok now)
not changed (see discussion on v2):
- using a function for gpmc config
- replacing config[1-7] by an array
compile-tested on beagle, evm, overo, pandora, zoom[12]
best regards,
Matthias
Matthias Ludwig (5):
OMAP3EVM: net_chip uses CS5 not CS6
omap3: embedd gpmc_cs into gpmc config struct
omap3: remove typedefs for configuration structs
omap3: replace all instances of gpmc config struct by one global
omap3: use only fixed-size types inside ctrl_structs
board/omap3/beagle/beagle.c | 6 +-
board/omap3/evm/evm.c | 19 +-
board/omap3/pandora/pandora.c | 8 +-
board/omap3/zoom2/zoom2.c | 13 +-
cpu/arm_cortexa8/omap3/board.c | 16 +-
cpu/arm_cortexa8/omap3/clock.c | 14 +-
cpu/arm_cortexa8/omap3/mem.c | 56 ++---
cpu/arm_cortexa8/omap3/sys_info.c | 13 +-
cpu/arm_cortexa8/omap3/timer.c | 2 +-
drivers/mtd/nand/omap_gpmc.c | 41 ++--
include/asm-arm/arch-omap3/cpu.h | 476 +++++++++++++++++++-----------------
include/asm-arm/arch-omap3/mem.h | 4 +-
include/asm-arm/arch-omap3/omap3.h | 8 +-
include/configs/omap3_beagle.h | 3 +-
include/configs/omap3_evm.h | 3 +-
include/configs/omap3_overo.h | 3 +-
include/configs/omap3_pandora.h | 3 +-
include/configs/omap3_zoom1.h | 3 +-
include/configs/omap3_zoom2.h | 3 +-
19 files changed, 342 insertions(+), 352 deletions(-)
4
18
KB9202: Add NAND support
This is a forward port of the patch submitted by Christian from
Kwikbyte in 06/2007
(http://lists.denx.de/pipermail/u-boot/2007-June/022068.html)
Signed-off-by: Matthias Kaehlcke <matthias(a)kaehlcke.net>
--
--- u-boot-2009.03.org/board/kb9202/Makefile 2009-03-21 22:04:41.000000000 +0100
+++ u-boot-2009.03/board/kb9202/Makefile 2009-05-15 23:30:11.000000000 +0200
@@ -28,7 +28,7 @@
LIB = $(obj)lib$(BOARD).a
-COBJS := kb9202.o
+COBJS := kb9202.o nand.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
--- /dev/null 2009-05-14 23:36:38.280017984 +0200
+++ u-boot-2009.03/board/kb9202/nand.c 2009-05-15 23:30:11.000000000 +0200
@@ -0,0 +1,158 @@
+/*
+ * (C) Copyright 2006 KwikByte kb9200_dev(a)kwikbyte.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 <asm/io.h>
+#include <asm/arch/AT91RM9200.h>
+#include <asm/arch/hardware.h>
+
+#ifdef CONFIG_CMD_NAND
+
+#include <nand.h>
+
+/*
+ * hardware specific access to control-lines
+ */
+
+#define MASK_ALE (1 << 22) /* our ALE is A22 */
+#define MASK_CLE (1 << 21) /* our CLE is A21 */
+
+#ifndef CONFIG_KB9202B_ATL
+#define KB9202_NAND_NCE (1 << 28) /* EN* on D28 */
+#define KB9202_NAND_BUSY (1 << 29) /* RB* on D29 */
+#else
+#define KB9202_NAND_NCE (1 << 26) /* EN* on PB26 */
+#define KB9202_NAND_BUSY (1 << 27) /* RB* on PB27 */
+#endif
+
+/*
+ * Board-specific function to access device control signals
+ */
+static void kb9202_nand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
+{
+ struct nand_chip *this = mtd->priv;
+
+ if (ctrl & NAND_CTRL_CHANGE) {
+ ulong IO_ADDR_W = (ulong) this->IO_ADDR_W;
+
+ /* clear ALE and CLE bits */
+ IO_ADDR_W &= ~(MASK_ALE | MASK_CLE);
+
+ if (ctrl & NAND_CLE)
+ IO_ADDR_W |= MASK_CLE;
+
+ if (ctrl & NAND_ALE)
+ IO_ADDR_W |= MASK_ALE;
+
+ this->IO_ADDR_W = (void *) IO_ADDR_W;
+
+ if (ctrl & NAND_NCE)
+ AT91C_BASE_PIOC->PIO_CODR = KB9202_NAND_NCE;
+ else
+ AT91C_BASE_PIOC->PIO_SODR = KB9202_NAND_NCE;
+ }
+
+ if (cmd != NAND_CMD_NONE)
+ writeb(cmd, this->IO_ADDR_W);
+}
+
+
+/*
+ * Board-specific function to access the device ready signal.
+ */
+static int kb9202_nand_ready(struct mtd_info *mtd)
+{
+ return (((AT91C_BASE_PIOC->PIO_PDSR) & KB9202_NAND_BUSY) != 0);
+}
+
+
+/*
+ * Board-specific NAND init. Copied from include/linux/mtd/nand.h for reference.
+ *
+ * struct nand_chip - NAND Private Flash Chip Data
+ * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device
+ * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device
+ * @hwcontrol: [BOARDSPECIFIC] hardwarespecific function for accesing control-lines
+ * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line
+ * If set to NULL no access to ready/busy is available and the ready/busy information
+ * is read from the chip status register
+ * @enable_hwecc: [BOARDSPECIFIC] function to enable (reset) hardware ecc generator. Must only
+ * be provided if a hardware ECC is available
+ * @eccmode: [BOARDSPECIFIC] mode of ecc, see defines
+ * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR)
+ * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
+ * special functionality. See the defines for further explanation
+*/
+/*
+ * This routine initializes controller and GPIOs.
+ */
+int board_nand_init(struct nand_chip *nand)
+{
+ unsigned value;
+
+ nand->ecc.mode = NAND_ECC_SOFT;
+ nand->options &= ~(NAND_BUSWIDTH_16);
+ nand->cmd_ctrl = kb9202_nand_hwcontrol;
+ nand->dev_ready = kb9202_nand_ready;
+
+ /* in case running outside of bootloader */
+ AT91C_BASE_PMC->PMC_PCER = ((unsigned) 1 << AT91C_ID_PIOC);
+#ifdef CONFIG_KB9202B_ATL
+ AT91C_BASE_PMC->PMC_PCER = ((unsigned) 1 << AT91C_ID_PIOB);
+#endif
+
+ /* setup nand flash access (allow ample margin) */
+ /* 4 wait states, 1 setup, 1 hold, 1 float for 8-bit device */
+ ((AT91PS_SMC2)AT91C_BASE_SMC2)->SMC2_CSR[3] =
+ AT91C_SMC2_WSEN |
+ (4 & AT91C_SMC2_NWS) |
+ ((1 << 8) & AT91C_SMC2_TDF) |
+ AT91C_SMC2_DBW_8 |
+ ((1 << 24) & AT91C_SMC2_RWSETUP) |
+ ((1 << 29) & AT91C_SMC2_RWHOLD);
+
+ /* enable internal NAND controller */
+ value = *(AT91C_EBI_CSA);
+ value |= AT91C_EBI_CS3A_SMC_SmartMedia;
+ *(AT91C_EBI_CSA) = value;
+
+ /* enable SMOE/SMWE */
+ AT91C_BASE_PIOC->PIO_ASR = AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE;
+ AT91C_BASE_PIOC->PIO_PDR = AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE;
+ AT91C_BASE_PIOC->PIO_OER = AT91C_PC1_BFRDY_SMOE | AT91C_PC3_BFBAA_SMWE;
+
+ /* set NCE to high */
+ AT91C_BASE_PIOC->PIO_SODR = KB9202_NAND_NCE;
+
+ /* disable output on pin connected to the busy line of the NAND */
+ AT91C_BASE_PIOC->PIO_ODR = KB9202_NAND_BUSY;
+
+ /* enable the PIO to control NCE and BUSY */
+ AT91C_BASE_PIOC->PIO_PER = KB9202_NAND_NCE | KB9202_NAND_BUSY;
+
+ /* enable output for NCE */
+ AT91C_BASE_PIOC->PIO_OER = KB9202_NAND_NCE;
+
+ return (0);
+}
+
+#endif /* CONFIG_CMD_NAND */
--- u-boot-2009.03.org/include/configs/kb9202.h 2009-05-15 23:31:55.000000000 +0200
+++ u-boot-2009.03/include/configs/kb9202.h 2009-05-15 23:30:11.000000000 +0200
@@ -62,6 +62,11 @@
#ifdef CONFIG_KB9202B
#define CONFIG_BOOTARGS "console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M"
#define CONFIG_BOOTCOMMAND "bootm 0x10000000"
+#define NAND_MAX_CHIPS 1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE 0x40000000
+#define CONFIG_JFFS2_NAND
+#define CONFIG_JFFS2_CMDLINE
#endif
@@ -71,7 +76,7 @@
/*
* Size of malloc() pool
*/
-#define CONFIG_SYS_MALLOC_LEN (128*1024)
+#define CONFIG_SYS_MALLOC_LEN (1024*1024)
#define CONFIG_SYS_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
#define CONFIG_BAUDRATE 115200
@@ -111,6 +116,9 @@
#define CONFIG_CMD_EEPROM
#define CONFIG_CMD_PING
#define CONFIG_CMD_DHCP
+#ifdef CONFIG_KB9202B
+#define CONFIG_CMD_NAND
+#endif
#define CONFIG_CMD_JFFS2
#undef CONFIG_CMD_BDI
@@ -140,7 +148,11 @@
#define PHYS_FLASH_SIZE 0x200000
#endif
+#ifdef CONFIG_KB9202B_ATL
+#define CFG_MAX_FLASH_BANKS 0
+#else
#define CONFIG_SYS_MAX_FLASH_BANKS 1
+#endif
#define CONFIG_SYS_MAX_FLASH_SECT 256
#define CONFIG_HARD_I2C
--
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona
El trabajo es el refugio de los que no tienen nada que hacer
(Oscar Wilde)
.''`.
using free software / Debian GNU/Linux | http://debian.org : :' :
`. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4 `-
5
20

05 Aug '09
Hi,
This patch adds support for KMC KZM-ARM11-01.
It was rebased to "next" branch.
Regards,
Tomohiro
Signed-off-by: Atsuo Igarashi <atsuo_igarashi(a)tripeaks.co.jp>
Signed-off-by: Tomohiro Masubuchi <tomohiro_masubuchi(a)tripeaks.co.jp>
----
Add support for KMC KZM-ARM11-01 board.
MAKEALL | 1 +
Makefile | 3 +
board/kzm_arm11_01/Makefile | 49 +++++++
board/kzm_arm11_01/config.mk | 1 +
board/kzm_arm11_01/kzm_arm11_01.c | 84 +++++++++++
board/kzm_arm11_01/lowlevel_init.S | 281 ++++++++++++++++++++++++++++++++++++
board/kzm_arm11_01/u-boot.lds | 72 +++++++++
include/configs/kzm_arm11_01.h | 184 +++++++++++++++++++++++
8 files changed, 675 insertions(+), 0 deletions(-)
diff --git a/MAKEALL b/MAKEALL
index 9ccb9ac..22f65ed 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -522,6 +522,7 @@ LIST_ARM11=" \
apollon \
imx31_litekit \
imx31_phycore \
+ kzm_arm11_01 \
mx31ads \
smdk6400 \
"
diff --git a/Makefile b/Makefile
index 017e4db..f334c57 100644
--- a/Makefile
+++ b/Makefile
@@ -2805,6 +2805,9 @@ imx31_litekit_config : unconfig
imx31_phycore_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm1136 imx31_phycore NULL mx31
+kzm_arm11_01_config : unconfig
+ @$(MKCONFIG) $(@:_config=) arm arm1136 kzm_arm11_01 NULL mx31
+
mx31ads_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm1136 mx31ads freescale mx31
diff --git a/board/kzm_arm11_01/Makefile b/board/kzm_arm11_01/Makefile
new file mode 100644
index 0000000..7e2f8ca
--- /dev/null
+++ b/board/kzm_arm11_01/Makefile
@@ -0,0 +1,49 @@
+#
+# Derived from mx31ads
+#
+# Copyright (C) 2008, Guennadi Liakhovetski <lg(a)denx.de>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB = $(obj)lib$(BOARD).a
+
+COBJS := kzm_arm11_01.o
+SOBJS := lowlevel_init.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+SOBJS := $(addprefix $(obj),$(SOBJS))
+
+$(LIB): $(obj).depend $(OBJS) $(SOBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+ rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+ rm -f $(LIB) core *.bak $(obj).depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/kzm_arm11_01/config.mk b/board/kzm_arm11_01/config.mk
new file mode 100644
index 0000000..d34dc02
--- /dev/null
+++ b/board/kzm_arm11_01/config.mk
@@ -0,0 +1 @@
+TEXT_BASE = 0x87f00000
diff --git a/board/kzm_arm11_01/kzm_arm11_01.c b/board/kzm_arm11_01/kzm_arm11_01.c
new file mode 100644
index 0000000..ed253d7
--- /dev/null
+++ b/board/kzm_arm11_01/kzm_arm11_01.c
@@ -0,0 +1,84 @@
+/*
+ * Derived from mx31ads
+ *
+ * Copyright (C) 2008, Guennadi Liakhovetski <lg(a)denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/mx31.h>
+#include <asm/arch/mx31-regs.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init (void)
+{
+ gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+ gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+ return 0;
+}
+
+int board_init (void)
+{
+ int i;
+
+ /* CS0 & CS1: Nor Flash */
+ /*
+ * CS0L, CS0A and CS0U values are from the RedBoot sources.
+ */
+ __REG(CSCR_U(0)) = 0x00001801;
+ __REG(CSCR_L(0)) = 0x45450D01;
+ __REG(CSCR_A(0)) = 0x00450000;
+
+ __REG(CSCR_U(1)) = 0x00001801;
+ __REG(CSCR_L(1)) = 0x45450D01;
+ __REG(CSCR_A(1)) = 0x00450000;
+
+ /* setup pins for UART1 */
+ mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX);
+ mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX);
+ mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
+ mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);
+
+ /* SPI2 */
+ mx31_gpio_mux(MUX_CSPI2_SS2__CSPI2_SS2_B);
+ mx31_gpio_mux(MUX_CSPI2_SCLK__CSPI2_CLK);
+ mx31_gpio_mux(MUX_CSPI2_SPI_RDY__CSPI2_DATAREADY_B);
+ mx31_gpio_mux(MUX_CSPI2_MOSI__CSPI2_MOSI);
+ mx31_gpio_mux(MUX_CSPI2_MISO__CSPI2_MISO);
+ mx31_gpio_mux(MUX_CSPI2_SS0__CSPI2_SS0_B);
+ mx31_gpio_mux(MUX_CSPI2_SS1__CSPI2_SS1_B);
+
+ /* start SPI2 clock */
+ __REG(CCM_CGR2) = __REG(CCM_CGR2) | (3 << 4);
+
+ gd->bd->bi_arch_number = MACH_TYPE_KZM_ARM11_01;/* board id for linux */
+ gd->bd->bi_boot_params = 0x80000100; /* adress of boot parameters */
+
+ return 0;
+}
+
+int checkboard (void)
+{
+ printf("Board: KZM-ARM11-01\n");
+ return 0;
+}
diff --git a/board/kzm_arm11_01/lowlevel_init.S b/board/kzm_arm11_01/lowlevel_init.S
new file mode 100644
index 0000000..f2032a5
--- /dev/null
+++ b/board/kzm_arm11_01/lowlevel_init.S
@@ -0,0 +1,281 @@
+/*
+ * Derived from mx31ads
+ *
+ * Copyright (C) 2008, Guennadi Liakhovetski <lg(a)denx.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/arch/mx31-regs.h>
+
+.macro REG reg, val
+ ldr r2, =\reg
+ ldr r3, =\val
+ str r3, [r2]
+.endm
+
+.macro REG8 reg, val
+ ldr r2, =\reg
+ ldr r3, =\val
+ strb r3, [r2]
+.endm
+
+.macro DELAY loops
+ ldr r2, =\loops
+1:
+ subs r2, r2, #1
+ nop
+ bcs 1b
+.endm
+
+/* RedBoot: AIPS setup - Only setup MPROTx registers.
+ * The PACR default values are good.*/
+.macro init_aips
+ /*
+ * Set all MPROTx to be non-bufferable, trusted for R/W,
+ * not forced to user-mode.
+ */
+ ldr r0, =0x43F00000
+ ldr r1, =0x77777777
+ str r1, [r0, #0x00]
+ str r1, [r0, #0x04]
+ ldr r0, =0x53F00000
+ str r1, [r0, #0x00]
+ str r1, [r0, #0x04]
+
+ /*
+ * Clear the on and off peripheral modules Supervisor Protect bit
+ * for SDMA to access them. Did not change the AIPS control registers
+ * (offset 0x20) access type
+ */
+ ldr r0, =0x43F00000
+ ldr r1, =0x0
+ str r1, [r0, #0x40]
+ str r1, [r0, #0x44]
+ str r1, [r0, #0x48]
+ str r1, [r0, #0x4C]
+ ldr r1, [r0, #0x50]
+ and r1, r1, #0x00FFFFFF
+ str r1, [r0, #0x50]
+
+ ldr r0, =0x53F00000
+ ldr r1, =0x0
+ str r1, [r0, #0x40]
+ str r1, [r0, #0x44]
+ str r1, [r0, #0x48]
+ str r1, [r0, #0x4C]
+ ldr r1, [r0, #0x50]
+ and r1, r1, #0x00FFFFFF
+ str r1, [r0, #0x50]
+.endm /* init_aips */
+
+/* RedBoot: MAX (Multi-Layer AHB Crossbar Switch) setup */
+.macro init_max
+ ldr r0, =0x43F04000
+ /* MPR - priority is M4 > M2 > M3 > M5 > M0 > M1 */
+ ldr r1, =0x00302154
+ str r1, [r0, #0x000] /* for S0 */
+ str r1, [r0, #0x100] /* for S1 */
+ str r1, [r0, #0x200] /* for S2 */
+ str r1, [r0, #0x300] /* for S3 */
+ str r1, [r0, #0x400] /* for S4 */
+ /* SGPCR - always park on last master */
+ ldr r1, =0x10
+ str r1, [r0, #0x010] /* for S0 */
+ str r1, [r0, #0x110] /* for S1 */
+ str r1, [r0, #0x210] /* for S2 */
+ str r1, [r0, #0x310] /* for S3 */
+ str r1, [r0, #0x410] /* for S4 */
+ /* MGPCR - restore default values */
+ ldr r1, =0x0
+ str r1, [r0, #0x800] /* for M0 */
+ str r1, [r0, #0x900] /* for M1 */
+ str r1, [r0, #0xA00] /* for M2 */
+ str r1, [r0, #0xB00] /* for M3 */
+ str r1, [r0, #0xC00] /* for M4 */
+ str r1, [r0, #0xD00] /* for M5 */
+.endm /* init_max */
+
+/* RedBoot: M3IF setup */
+.macro init_m3if
+ /* Configure M3IF registers */
+ ldr r1, =0xB8003000
+ /*
+ * M3IF Control Register (M3IFCTL)
+ * MRRP[0] = L2CC0 not on priority list (0 << 0) = 0x00000000
+ * MRRP[1] = L2CC1 not on priority list (0 << 0) = 0x00000000
+ * MRRP[2] = MBX not on priority list (0 << 0) = 0x00000000
+ * MRRP[3] = MAX1 not on priority list (0 << 0) = 0x00000000
+ * MRRP[4] = SDMA not on priority list (0 << 0) = 0x00000000
+ * MRRP[5] = MPEG4 not on priority list (0 << 0) = 0x00000000
+ * MRRP[6] = IPU1 on priority list (1 << 6) = 0x00000040
+ * MRRP[7] = IPU2 not on priority list (0 << 0) = 0x00000000
+ * ------------
+ * 0x00000040
+ */
+ ldr r0, =0x00000040
+ str r0, [r1] /* M3IF control reg */
+.endm /* init_m3if */
+
+/* RedBoot: To support 133MHz DDR */
+.macro init_drive_strength
+ /*
+ * Disable maximum drive strength SDRAM/DDR lines by clearing DSE1 bits
+ * in SW_PAD_CTL registers
+ */
+
+ /* SDCLK */
+ ldr r1, =0x43FAC200
+ ldr r0, [r1, #0x6C]
+ bic r0, r0, #(1 << 12)
+ str r0, [r1, #0x6C]
+
+ /* CAS */
+ ldr r0, [r1, #0x70]
+ bic r0, r0, #(1 << 22)
+ str r0, [r1, #0x70]
+
+ /* RAS */
+ ldr r0, [r1, #0x74]
+ bic r0, r0, #(1 << 2)
+ str r0, [r1, #0x74]
+
+ /* CS2 (CSD0) */
+ ldr r0, [r1, #0x7C]
+ bic r0, r0, #(1 << 22)
+ str r0, [r1, #0x7C]
+
+ /* DQM3 */
+ ldr r0, [r1, #0x84]
+ bic r0, r0, #(1 << 22)
+ str r0, [r1, #0x84]
+
+ /* DQM2, DQM1, DQM0, SD31-SD0, A25-A0, MA10 (0x288..0x2DC) */
+ ldr r2, =22 /* (0x2E0 - 0x288) / 4 = 22 */
+pad_loop:
+ ldr r0, [r1, #0x88]
+ bic r0, r0, #(1 << 22)
+ bic r0, r0, #(1 << 12)
+ bic r0, r0, #(1 << 2)
+ str r0, [r1, #0x88]
+ add r1, r1, #4
+ subs r2, r2, #0x1
+ bne pad_loop
+.endm /* init_drive_strength */
+
+/* CPLD on CS4 setup */
+.macro init_cs4
+ ldr r0, =WEIM_BASE
+ ldr r1, =0x00001003
+ str r1, [r0, #0x40]
+ ldr r1, =0x74741B01
+ str r1, [r0, #0x44]
+ ldr r1, =0x00740000
+ str r1, [r0, #0x48]
+.endm /* init_cs4 */
+
+/* LAN on CS5 setup */
+.macro init_cs5
+ ldr r0, =WEIM_BASE
+ ldr r1, =0x00001403
+ str r1, [r0, #0x50]
+ ldr r1, =0x44340D01
+ str r1, [r0, #0x54]
+ ldr r1, =0x00340000
+ str r1, [r0, #0x58]
+.endm /* init_cs5 */
+
+.globl lowlevel_init
+lowlevel_init:
+
+ /* Redboot initializes very early AIPS, what for?
+ * Then it also initializes Multi-Layer AHB Crossbar Switch,
+ * M3IF */
+ /* Also setup the Peripheral Port Remap register inside the core */
+ ldr r0, =0x40000015 /* start from AIPS 2GB region */
+ mcr p15, 0, r0, c15, c2, 4
+
+ init_aips
+
+ init_max
+
+ init_m3if
+
+ init_drive_strength
+
+ init_cs4
+
+ /* Image Processing Unit: */
+ /* Too early to switch display on? */
+ REG IPU_CONF, IPU_CONF_DI_EN /* Switch on Display Interface */
+ /* Clock Control Module: */
+ REG CCM_CCMR, 0x074B0BF5 /* Use CKIH, MCU PLL off */
+
+ DELAY 0x40000
+
+ REG CCM_CCMR, 0x074B0BF5 | CCMR_MPE /* MCU PLL on */
+ REG CCM_CCMR, (0x074B0BF5 | CCMR_MPE) & ~CCMR_MDS /* Switch to MCU PLL */
+
+ /* 532-133-66.5 */
+ ldr r0, =CCM_BASE
+ ldr r1, =0xFF872660
+ /* PDR0 */
+ str r1, [r0, #0x4]
+ ldreq r1, MPCTL_PARAM_532
+ ldrne r1, MPCTL_PARAM_532_27
+ /* MPCTL */
+ str r1, [r0, #0x10]
+
+ ldreq r1, UPCTL_PARAM_240
+ ldrne r1, UPCTL_PARAM_240_27
+ /* UPCTL */
+ str r1, [r0, #0x14]
+ /* default CLKO to 1/8 of the ARM core */
+ mov r1, #0x000002C0
+ add r1, r1, #0x00000006
+ /* COSR */
+ str r1, [r0, #0x1c]
+
+ /* Default: 1, 4, 12, 1 */
+ REG CCM_SPCTL, PLL_PD(1) | PLL_MFD(4) | PLL_MFI(12) | PLL_MFN(1)
+
+ /* B8xxxxxx - NAND, 8xxxxxxx - CSD0 RAM */
+ REG 0xB8001010, 0x00000004
+ REG 0xB8001004, 0x0079d72a
+ REG 0xB8001000, 0x92100000
+ REG 0x80000f00, 0x12344321
+ REG 0xB8001000, 0xa2100000
+ REG 0x80000000, 0x12344321
+ REG 0x80000000, 0x12344321
+ REG 0xB8001000, 0xb2100000
+ REG8 0x81000020, 0x00
+ REG8 0x80000033, 0xda
+ REG 0xB8001000, 0x82226080
+ REG 0x80000000, 0xDEADBEEF
+ REG 0xB8001010, 0x0000000c
+
+ init_cs5
+
+ mov pc, lr
+
+MPCTL_PARAM_532:
+ .word (((1-1) << 26) + ((52-1) << 16) + (10 << 10) + (12 << 0))
+MPCTL_PARAM_532_27:
+ .word (((1-1) << 26) + ((15-1) << 16) + (9 << 10) + (13 << 0))
+UPCTL_PARAM_240:
+ .word (((2-1) << 26) + ((13-1) << 16) + (9 << 10) + (3 << 0))
+UPCTL_PARAM_240_27:
+ .word (((2-1) << 26) + ((9 -1) << 16) + (8 << 10) + (8 << 0))
diff --git a/board/kzm_arm11_01/u-boot.lds b/board/kzm_arm11_01/u-boot.lds
new file mode 100644
index 0000000..aa87fcb
--- /dev/null
+++ b/board/kzm_arm11_01/u-boot.lds
@@ -0,0 +1,72 @@
+/*
+ * Derived from mx31ads
+ *
+ * January 2004 - Changed to support H4 device
+ * Copyright (c) 2004 Texas Instruments
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <gj(a)denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+ . = 0x00000000;
+
+ . = ALIGN(4);
+ .text :
+ {
+ /* WARNING - the following is hand-optimized to fit within */
+ /* the sector layout of our flash chips! XXX FIXME XXX */
+
+ cpu/arm1136/start.o (.text)
+ board/kzm_arm11_01/libkzm_arm11_01.a (.text)
+ lib_arm/libarm.a (.text)
+ net/libnet.a (.text)
+ drivers/mtd/libmtd.a (.text)
+
+ . = DEFINED(env_offset) ? env_offset : .;
+ common/env_embedded.o(.text)
+
+ *(.text)
+ }
+
+ . = ALIGN(4);
+ .rodata : { *(.rodata) }
+
+ . = ALIGN(4);
+ .data : { *(.data) }
+
+ . = ALIGN(4);
+ .got : { *(.got) }
+
+ . = .;
+ __u_boot_cmd_start = .;
+ .u_boot_cmd : { *(.u_boot_cmd) }
+ __u_boot_cmd_end = .;
+
+ . = ALIGN(4);
+ __bss_start = .;
+ .bss : { *(.bss) }
+ _end = .;
+}
diff --git a/include/configs/kzm_arm11_01.h b/include/configs/kzm_arm11_01.h
new file mode 100644
index 0000000..72f7b5a
--- /dev/null
+++ b/include/configs/kzm_arm11_01.h
@@ -0,0 +1,184 @@
+/*
+ * Derived from mx31ads
+ *
+ * Copyright (C) 2008, Guennadi Liakhovetski <lg(a)denx.de>
+ *
+ * Configuration settings for the KMC KZM-ARM11-01 board.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/arch/mx31-regs.h>
+
+ /* High Level Configuration Options */
+#define CONFIG_ARM1136 1 /* This is an arm1136 CPU core */
+#define CONFIG_MX31 1 /* in a mx31 */
+#define CONFIG_MX31_HCLK_FREQ 26000000 /* RedBoot says 26MHz */
+#define CONFIG_MX31_CLK32 32768
+
+#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_DISPLAY_BOARDINFO
+
+#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG 1
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128 * 1024)
+#define CONFIG_SYS_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
+
+/*
+ * Hardware drivers
+ */
+
+#define CONFIG_MX31_UART 1
+#define CONFIG_SYS_MX31_UART1 1
+
+#define CONFIG_HARD_SPI 1
+#define CONFIG_MXC_SPI 1
+#define CONFIG_DEFAULT_SPI_BUS 1
+#define CONFIG_DEFAULT_SPI_MODE (SPI_MODE_2 | SPI_CS_HIGH)
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+#define CONFIG_CONS_INDEX 1
+#define CONFIG_BAUDRATE 115200
+#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200}
+
+/***********************************************************
+ * Command definition
+ ***********************************************************/
+
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_SPI
+#define CONFIG_CMD_FLASH
+
+#define CONFIG_BOOTDELAY 3
+
+#define CONFIG_LOADADDR 0x80800000 /* loadaddr env var */
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "netdev=eth0\0" \
+ "uboot_addr=0xa0000000\0" \
+ "uboot=kzm-arm11/u-boot.bin\0" \
+ "kernel=kzm-arm11/uImage\0" \
+ "nfsroot=${serverip}:${rootpath}\0" \
+ "bootargs_base=setenv bootargs console=ttymxc0,115200\0" \
+ "bootargs_nfs=setenv bootargs ${bootargs} root=/dev/nfs " \
+ "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+ "bootcmd=run bootcmd_net\0" \
+ "bootcmd_net=run bootargs_base bootargs_nfs; " \
+ "tftpboot ${loadaddr} ${kernel}; bootm\0" \
+ "prg_uboot=tftpboot ${loadaddr} ${uboot}; " \
+ "protect off ${uboot_addr} 0xa007ffff; " \
+ "erase ${uboot_addr} 0xa007ffff; " \
+ "cp.b ${loadaddr} ${uboot_addr} ${filesize}; " \
+ "setenv filesize; saveenv\0"
+
+#define CONFIG_DRIVER_SMC911X 1
+#define CONFIG_DRIVER_SMC911X_BASE 0xb6020300
+#define CONFIG_DRIVER_SMC911X_32_BIT 1
+
+/*
+ * The KZM-ARM11-01 board seems to have a hardware "peculiarity" confirmed under
+ * U-Boot, RedBoot and Linux: the ethernet Rx signal is reaching the SMC9118
+ * controller inverted. The controller is capable of detecting and correcting
+ * this, but it needs a few hundred milliseconds wait for that after the
+ * initialization. Which means, at startup, you will not receive answers
+ * during the first few hundred milliseconds, unless there have been some
+ * broadcasts on the network, or your board is on a hub. Reducing the ARP
+ * timeout from default 5 seconds to 200ms we speed up the initial TFTP
+ * transfer, should the user wish one, significantly.
+ */
+#define CONFIG_ARP_TIMEOUT 200UL
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP /* undef to save memory */
+#define CONFIG_SYS_PROMPT "=> "
+#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
+
+#define CONFIG_SYS_MEMTEST_START 0 /* memtest works on */
+#define CONFIG_SYS_MEMTEST_END 0x10000
+
+#define CONFIG_SYS_LOAD_ADDR CONFIG_LOADADDR
+
+#define CONFIG_SYS_HZ 1000
+
+#define CONFIG_CMDLINE_EDITING 1
+
+/*-----------------------------------------------------------------------
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE (128 * 1024) /* regular stack */
+
+/*-----------------------------------------------------------------------
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS 1
+#define PHYS_SDRAM_1 CSD0_BASE
+#define PHYS_SDRAM_1_SIZE (128 * 1024 * 1024)
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_FLASH_BASE CS0_BASE
+#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */
+#define CONFIG_SYS_MAX_FLASH_SECT 512 /* max number of sectors on one chip */
+#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE /* Monitor at beginning of flash */
+#define CONFIG_SYS_MONITOR_LEN (256 * 1024) /* Reserve 256KiB */
+
+#define CONFIG_ENV_IS_IN_FLASH 1
+#define CONFIG_ENV_SECT_SIZE (128 * 1024)
+#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE
+
+/* Address and size of Redundant Environment Sector */
+#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
+#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
+
+/* S29GL512N NOR flash has 512 128KiB big sectors. */
+#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_ENV_SECT_SIZE)
+
+/*-----------------------------------------------------------------------
+ * CFI FLASH driver setup
+ */
+#define CONFIG_SYS_FLASH_CFI 1 /* Flash memory is CFI compliant */
+#define CONFIG_FLASH_CFI_DRIVER 1 /* Use drivers/cfi_flash.c */
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1 /* Use buffered writes (~10x faster) */
+#define CONFIG_SYS_FLASH_PROTECTION 1 /* Use hardware sector protection */
+
+/*
+ * JFFS2 partitions
+ */
+#undef CONFIG_JFFS2_CMDLINE
+#define CONFIG_JFFS2_DEV "nor0"
+
+#endif /* __CONFIG_H */
2
1
Hi,
I'm running U-Boot 1.3.4 on custom 460EX based board,
equipped with 64M P33 flash (similar to Intel P30). See
http://www.numonyx.com/Documents/Datasheets/314749_P33_Discrete_DS.pdf
This flash is comprised internally of two 32M flashes.
I have the following declarations in configuration file:
#define CFG_FLASH_CFI /* The flash is CFI compatible */
#define CFG_FLASH_CFI_DRIVER /* Use common CFI driver */
#define CFG_FLASH_BANKS_LIST {CFG_FLASH_BASE}
#define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */
#define CFG_MAX_FLASH_SECT 518 /* max number of sectors on one
chip */
#define CFG_FLASH_USE_BUFFER_WRITE 1 /* use buffered writes (20x
faster) */
#define CFG_FLASH_PROTECTION 1 /* use hardware flash
protection */
#define CFG_FLASH_EMPTY_INFO /* print 'E' for empty sector on
flinfo */
U-Boot identifies this flash as 32M flash. Below is debug output from
CFI driver:
FLASH: flash detect cfi
fwc addr fc000000 cmd f0 f0 8bit x 8 bit
fwc addr fc000000 cmd ff ff 8bit x 8 bit
fwc addr fc000055 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fc000010 is= 0 51
fwc addr fc000555 cmd 98 98 8bit x 8 bit
is= cmd 51(Q) addr fc000010 is= 0 51
fwc addr fc000000 cmd f0 f0f0 16bit x 8 bit
fwc addr fc000000 cmd ff ffff 16bit x 8 bit
fwc addr fc0000aa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fc000020 is= 0051 5151
fwc addr fc000aaa cmd 98 9898 16bit x 8 bit
is= cmd 51(Q) addr fc000020 is= 0051 5151
fwc addr fc000000 cmd f0 00f0 16bit x 16 bit
fwc addr fc000000 cmd ff 00ff 16bit x 16 bit
fwc addr fc0000aa cmd 98 0098 16bit x 16 bit
is= cmd 51(Q) addr fc000020 is= 0051 0051
is= cmd 52(R) addr fc000022 is= 0052 0052
is= cmd 59(Y) addr fc000024 is= 0059 0059
device interface is 1
found port 2 chip 2 port 16 bits chip 16 bits
00 : 51 52 59 01 00 0a 01 00 00 00 00 23 36 85 95 08 QRY........#6...
10 : 09 0a 00 01 01 02 00 19 01 00 06 00 02 03 00 80 ................
20 : 00 fe 00 00 02 00 00 00 00 ff ff ff ff fc 36 a4 ..............6.
fwc addr fc000000 cmd ff 00ff 16bit x 16 bit
fwc addr fc000000 cmd 90 0090 16bit x 16 bit
fwc addr fc000000 cmd ff 00ff 16bit x 16 bit
fwc addr fc0000aa cmd 98 0098 16bit x 16 bit
manufacturer is 1
manufacturer id is 0x89
device id is 0x22
device id2 is 0x0
cfi version is 0x3135
size_ratio 1 port 16 bits chip 16 bits
found 2 erase regions
erase region 0: 0x00800003
erase_region_count = 4 erase_region_size = 32768
erase region 1: 0x020000fe
erase_region_count = 255 erase_region_size = 131072
fwc addr fc000000 cmd ff 00ff 16bit x 16 bit
32 MB
What should I change in configuration/driver to get
all 64M of flash detected ?
Thanks a lot.
Felix.
4
4
This patch updates the support for EB+MCF-EV123 board
and needs the [PATCH 1/2] new video driver for bus vcxk framebuffers
* remove the board framebuffer driver
* use the common bus_vcxk framebuffer driver
* adds bmp support
* adds splashimage support
* fix serveral cosmetical errors
Signed-off-by: Jens Scharsig <esw(a)bus-elektronik.de>
---
diff --git a/board/BuS/EB+MCF-EV123/EB+MCF-EV123.c b/board/BuS/EB+MCF-EV123/EB+MCF-EV123.c
index 02a095e..484a5e0 100644
--- a/board/BuS/EB+MCF-EV123/EB+MCF-EV123.c
+++ b/board/BuS/EB+MCF-EV123/EB+MCF-EV123.c
@@ -27,7 +27,18 @@
#include <common.h>
#include <command.h>
#include "asm/m5282.h"
-#include "VCxK.h"
+#include <bmp_layout.h>
+#include <status_led.h>
+#include <bus_vcxk.h>
+
+/*---------------------------------------------------------------------------*/
+
+DECLARE_GLOBAL_DATA_PTR;
+
+unsigned long display_width;
+unsigned long display_height;
+
+/*---------------------------------------------------------------------------*/
int checkboard (void)
{
@@ -89,7 +100,6 @@ phys_size_t initdram (int board_type)
return size;
}
-
#if defined(CONFIG_SYS_DRAM_TEST)
int testdram (void)
{
@@ -126,37 +136,108 @@ int testdram (void)
int misc_init_r(void)
{
- init_vcxk();
+#ifdef CONFIG_HW_WATCHDOG
+ hw_watchdog_init();
+#endif
+#ifndef CONFIG_VIDEO
+ vcxk_init(16,16);
+#endif
return 1;
}
+#if defined(CONFIG_VIDEO)
+
+/*----------------------------------------------------------------------------
+ ****h* EB+CPU5282-T1/drv_video_init
+ * FUNCTION
+ ***
+----------------------------------------------------------------------------*/
+
+int drv_video_init (void)
+{
+ char *s;
+ unsigned long splash;
+
+ printf("Init Video as ");
+
+ if ((s = getenv ("displaywidth")) != NULL)
+ {
+ display_width = simple_strtoul (s, NULL, 10);
+ }
+ else
+ {
+ display_width=256;
+ }
+ if ((s = getenv ("displayheight")) != NULL)
+ {
+ display_height = simple_strtoul (s, NULL, 10);
+ }
+ else
+ {
+ display_height=256;
+ }
+ printf("%lu x %lu pixel matrix\n",display_width,display_height);
+ vcxk_init(display_width,display_height);
+
+#ifdef CONFIG_SPLASH_SCREEN
+ if ((s = getenv ("splashimage")) != NULL)
+ {
+ debug("use splashimage: %s\n",s);
+ splash = simple_strtoul (s, NULL, 16);
+ debug("use splashimage: %x\n",splash);
+ vcxk_acknowledge_wait();
+ video_display_bitmap (splash, 0, 0);
+ }
+#endif
+ return 0;
+}
+
+#endif
+
/*---------------------------------------------------------------------------*/
-int do_vcimage (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+#ifdef CONFIG_VIDEO
+int do_brightness (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
int rcode = 0;
- ulong source;
+ ulong side;
+ ulong bright;
switch (argc) {
- case 2:
- source = simple_strtoul(argv[1],NULL,16);
- vcxk_loadimage(source);
- rcode = 0;
+ case 3:
+ side = simple_strtoul(argv[1],NULL,10);
+ bright = simple_strtoul(argv[2],NULL,10);
+ if ((side>=0) && (side<=3) &&
+ (bright>=0) && (bright<=1000))
+ {
+ vcxk_setbrightness(side,bright);
+ rcode = 0;
+ }
+ else
+ {
+ printf ("parameters out of range\n");
+ printf ("Usage:\n%s\n", cmdtp->usage);
+ rcode = 1;
+ }
break;
default:
- cmd_usage(cmdtp);
+ printf ("Usage:\n%s\n", cmdtp->usage);
rcode = 1;
break;
}
return rcode;
}
-/***************************************************/
+/*---------------------------------------------------------------------------*/
U_BOOT_CMD(
- vcimage, 2, 0, do_vcimage,
- "loads an image to Display",
- "vcimage addr\n"
+ bright, 3, 0, do_brightness,
+ "sets the display brightness\n",
+ " <side> <0..1000>\n side: 0/3=both; 1=first; 2=second\n"
);
-/* EOF EB+MCF-EV123c */
+#endif
+
+/*---------------------------------------------------------------------------*/
+/* EOF EB+MCF-EV123.c */
+/*---------------------------------------------------------------------------*/
diff --git a/board/BuS/EB+MCF-EV123/Makefile b/board/BuS/EB+MCF-EV123/Makefile
index ed3ac07..44961b9 100644
--- a/board/BuS/EB+MCF-EV123/Makefile
+++ b/board/BuS/EB+MCF-EV123/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).a
-COBJS = $(BOARD).o cfm_flash.o flash.o VCxK.o
+COBJS = $(BOARD).o cfm_flash.o flash.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
diff --git a/board/BuS/EB+MCF-EV123/VCxK.c b/board/BuS/EB+MCF-EV123/VCxK.c
deleted file mode 100644
index f2fe353..0000000
--- a/board/BuS/EB+MCF-EV123/VCxK.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * (C) Copyright 2005
- * BuS Elektronik GmbH & Co.KG <esw(a)bus-elektonik.de>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/m5282.h>
-#include "VCxK.h"
-
-vu_char *vcxk_bws = (vu_char *)(CONFIG_SYS_CS3_BASE);
-#define VCXK_BWS vcxk_bws
-
-static ulong vcxk_driver;
-
-
-ulong search_vcxk_driver(void);
-void vcxk_cls(void);
-void vcxk_setbrightness(short brightness);
-int vcxk_request(void);
-int vcxk_acknowledge_wait(void);
-void vcxk_clear(void);
-
-int init_vcxk(void)
-{
- VIDEO_Invert_CFG &= ~VIDEO_Invert_IO;
- VIDEO_INVERT_PORT |= VIDEO_INVERT_PIN;
- VIDEO_INVERT_DDR |= VIDEO_INVERT_PIN;
-
- VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN;
- VIDEO_REQUEST_DDR |= VIDEO_REQUEST_PIN;
-
- VIDEO_ACKNOWLEDGE_DDR &= ~VIDEO_ACKNOWLEDGE_PIN;
-
- vcxk_driver = search_vcxk_driver();
- if (vcxk_driver)
- {
- /* use flash resist driver */
- }
- else
- {
- vcxk_cls();
- vcxk_cls();
- vcxk_setbrightness(1000);
- }
- VIDEO_ENABLE_DDR |= VIDEO_ENABLE_PIN;
- VIDEO_ENABLE_PORT |= VIDEO_ENABLE_PIN;
- VIDEO_ENABLE_PORT &= ~VIDEO_ENABLE_PIN;
- return 1;
-}
-
-void vcxk_loadimage(ulong source)
-{
- int cnt;
- vcxk_acknowledge_wait();
- for (cnt=0; cnt<16384; cnt++)
- {
- VCXK_BWS[cnt*2] = (*(vu_char*) source);
- source++;
- }
- vcxk_request();
-}
-
-void vcxk_cls(void)
-{
- vcxk_acknowledge_wait();
- vcxk_clear();
- vcxk_request();
-}
-
-void vcxk_clear(void)
-{
- int cnt;
- for (cnt=0; cnt<16384; cnt++)
- {
- VCXK_BWS[cnt*2] = 0x00;
- }
-}
-
-void vcxk_setbrightness(short brightness)
-{
- VCXK_BWS[0x8000]=(brightness >> 4) +2;
- VCXK_BWS[0xC000]= (brightness + 23) >> 8;
- VCXK_BWS[0xC001]= (brightness + 23) & 0xFF;
-}
-
-int vcxk_request(void)
-{
- if (vcxk_driver)
- {
- /* use flash resist driver */
- }
- else
- {
- VIDEO_REQUEST_PORT &= ~VIDEO_REQUEST_PIN;
- VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN;
- }
- return 1;
-}
-
-int vcxk_acknowledge_wait(void)
-{
- if (vcxk_driver)
- {
- /* use flash resist driver */
- }
- else
- {
- while (!(VIDEO_ACKNOWLEDGE_PORT & VIDEO_ACKNOWLEDGE_PIN));
- }
- return 1;
-}
-
-ulong search_vcxk_driver(void)
-{
- return 0;
-}
-
-/* eof */
diff --git a/board/BuS/EB+MCF-EV123/VCxK.h b/board/BuS/EB+MCF-EV123/VCxK.h
deleted file mode 100644
index f591e5c..0000000
--- a/board/BuS/EB+MCF-EV123/VCxK.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * (C) Copyright 2005
- * BuS Elektronik GmbH & Co.KG <esw(a)bus-elektonik.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
- */
-
-#ifndef __VCXK_H_
-#define __VCXK_H_
-
-extern int init_vcxk(void);
-void vcxk_loadimage(ulong source);
-
-#define VIDEO_ACKNOWLEDGE_PORT MCFGPTB_GPTPORT
-#define VIDEO_ACKNOWLEDGE_DDR MCFGPTB_GPTDDR
-#define VIDEO_ACKNOWLEDGE_PIN 0x0001
-
-#define VIDEO_ENABLE_PORT MCFGPTB_GPTPORT
-#define VIDEO_ENABLE_DDR MCFGPTB_GPTDDR
-#define VIDEO_ENABLE_PIN 0x0002
-
-#define VIDEO_REQUEST_PORT MCFGPTB_GPTPORT
-#define VIDEO_REQUEST_DDR MCFGPTB_GPTDDR
-#define VIDEO_REQUEST_PIN 0x0004
-
-#define VIDEO_Invert_CFG MCFGPIO_PEPAR
-#define VIDEO_Invert_IO MCFGPIO_PEPAR_PEPA2
-#define VIDEO_INVERT_PORT MCFGPIO_PORTE
-#define VIDEO_INVERT_DDR MCFGPIO_DDRE
-#define VIDEO_INVERT_PIN MCFGPIO_PORT2
-
-#endif
diff --git a/include/configs/EB+MCF-EV123.h b/include/configs/EB+MCF-EV123.h
index a13db7c..816dc5f 100644
--- a/include/configs/EB+MCF-EV123.h
+++ b/include/configs/EB+MCF-EV123.h
@@ -1,7 +1,7 @@
/*
* Configuation settings for the BuS EB+MCF-EV123 boards.
*
- * (C) Copyright 2005 BuS Elektronik GmbH & Co.KG <esw(a)bus-elektonik.de>
+ * (C) Copyright 2005-2009 BuS Elektronik GmbH & Co.KG <esw(a)bus-elektonik.de>
*
* See file CREDITS for list of people who contributed to this
* project.
@@ -25,16 +25,15 @@
#ifndef _CONFIG_EB_MCF_EV123_H_
#define _CONFIG_EB_MCF_EV123_H_
-#define CONFIG_EB_MCF_EV123
-
#undef CONFIG_SYS_HALT_BEFOR_RAM_JUMP
-/*
- * High Level Configuration Options (easy to change)
- */
+/*-----------------------------------------------------------------------*/
+/* High Level Configuration Options (easy to change) */
+/*-----------------------------------------------------------------------*/
#define CONFIG_MCF52x2 /* define processor family */
#define CONFIG_M5282 /* define processor type */
+#define CONFIG_EB_MCF_EV123
#define CONFIG_MISC_INIT_R
@@ -43,29 +42,33 @@
#define CONFIG_BAUDRATE 9600
#define CONFIG_SYS_BAUDRATE_TABLE { 9600 , 19200 , 38400 , 57600, 115200 }
-#undef CONFIG_MONITOR_IS_IN_RAM /* define if monitor is started from a pre-loader */
+#undef CONFIG_MONITOR_IS_IN_RAM /* starts uboot direct */
#define CONFIG_BOOTCOMMAND "printenv"
-/* Configuration for environment
- * Environment is embedded in u-boot in the second sector of the flash
- */
+/*-----------------------------------------------------------------------*/
+/* Options */
+/*-----------------------------------------------------------------------*/
+
+#define CONFIG_BOOT_RETRY_TIME -1
+#define CONFIG_RESET_TO_RETRY
+#define CONFIG_SPLASH_SCREEN
+
+/*-----------------------------------------------------------------------*/
+/* Configuration for environment */
+/* Environment is in the second sector of the first 256k of flash */
+/*-----------------------------------------------------------------------*/
+
#ifndef CONFIG_MONITOR_IS_IN_RAM
-#define CONFIG_ENV_ADDR 0xF003C000 /* End of 256K */
+#define CONFIG_ENV_ADDR 0xF003C000 /* End of 256K */
#define CONFIG_ENV_SECT_SIZE 0x4000
#define CONFIG_ENV_IS_IN_FLASH 1
-/*
-#define CONFIG_ENV_IS_EMBEDDED 1
-#define CONFIG_ENV_ADDR_REDUND 0xF0018000
-#define CONFIG_ENV_SECT_SIZE_REDUND 0x4000
-*/
#else
-#define CONFIG_ENV_ADDR 0xFFE04000
+#define CONFIG_ENV_ADDR 0xFFE04000
#define CONFIG_ENV_SECT_SIZE 0x2000
#define CONFIG_ENV_IS_IN_FLASH 1
#endif
-
/*
* BOOTP options
*/
@@ -74,7 +77,6 @@
#define CONFIG_BOOTP_GATEWAY
#define CONFIG_BOOTP_HOSTNAME
-
/*
* Command line configuration.
*/
@@ -86,50 +88,20 @@
#define CONFIG_MCFTMR
-#define CONFIG_MCFFEC
-#ifdef CONFIG_MCFFEC
-# define CONFIG_NET_MULTI 1
-# define CONFIG_MII 1
-# define CONFIG_MII_INIT 1
-# define CONFIG_SYS_DISCOVER_PHY
-# define CONFIG_SYS_RX_ETH_BUFFER 8
-# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
-
-# define CONFIG_SYS_FEC0_PINMUX 0
-# define CONFIG_SYS_FEC0_MIIBASE CONFIG_SYS_FEC0_IOBASE
-# define MCFFEC_TOUT_LOOP 50000
-/* If CONFIG_SYS_DISCOVER_PHY is not defined - hardcoded */
-# ifndef CONFIG_SYS_DISCOVER_PHY
-# define FECDUPLEX FULL
-# define FECSPEED _100BASET
-# else
-# ifndef CONFIG_SYS_FAULT_ECHO_LINK_DOWN
-# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
-# endif
-# endif /* CONFIG_SYS_DISCOVER_PHY */
-#endif
-#ifdef CONFIG_MCFFEC
-# define CONFIG_ETHADDR 00:CF:52:82:EB:01
-# define CONFIG_IPADDR 192.162.1.2
-# define CONFIG_NETMASK 255.255.255.0
-# define CONFIG_SERVERIP 192.162.1.1
-# define CONFIG_GATEWAYIP 192.162.1.1
-# define CONFIG_OVERWRITE_ETHADDR_ONCE
-#endif /* CONFIG_MCFFEC */
-
-#define CONFIG_BOOTDELAY 5
+#define CONFIG_BOOTDELAY 5
+#define CONFIG_HUSH_PARSER
#define CONFIG_SYS_PROMPT "\nEV123 U-Boot> "
-#define CONFIG_SYS_LONGHELP /* undef to save memory */
+#define CONFIG_SYS_LONGHELP 1
#if defined(CONFIG_CMD_KGDB)
-#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
+#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
#else
#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
#endif
-#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
-#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
#define CONFIG_SYS_LOAD_ADDR 0x20000
@@ -138,7 +110,9 @@
/*#define CONFIG_SYS_DRAM_TEST 1 */
#undef CONFIG_SYS_DRAM_TEST
-/* Clock and PLL Configuration */
+/*-----------------------------------------------------------------------*/
+/* Clock and PLL Configuration */
+/*-----------------------------------------------------------------------*/
#define CONFIG_SYS_HZ 10000000
#define CONFIG_SYS_CLK 58982400 /* 9,8304MHz * 6 */
@@ -147,20 +121,42 @@
#define CONFIG_SYS_MFD 0x01 /* PLL Multiplication Factor Devider */
#define CONFIG_SYS_RFD 0x00 /* PLL Reduce Frecuency Devider */
-/*
+/*----------------------------------------------------------------------*/
+/* Network */
+/*----------------------------------------------------------------------*/
+
+#define CONFIG_MCFFEC
+#define CONFIG_NET_MULTI 1
+#define CONFIG_MII 1
+#define CONFIG_MII_INIT 1
+#define CONFIG_SYS_DISCOVER_PHY
+#define CONFIG_SYS_RX_ETH_BUFFER 8
+#define CONFIG_SYS_FAULT_ECHO_LINK_DOWN
+
+#define CONFIG_SYS_FEC0_PINMUX 0
+#define CONFIG_SYS_FEC0_MIIBASE CONFIG_SYS_FEC0_IOBASE
+#define MCFFEC_TOUT_LOOP 50000
+
+#define CONFIG_ETHADDR 00:CF:52:82:EB:01
+#define CONFIG_OVERWRITE_ETHADDR_ONCE
+
+/*-------------------------------------------------------------------------
* Low Level Configuration Settings
* (address mappings, register initial values, etc.)
* You should know what you are doing if you make changes here.
- */
-#define CONFIG_SYS_MBAR 0x40000000
+ *-----------------------------------------------------------------------*/
+
+#define CONFIG_SYS_MBAR 0x40000000
/*-----------------------------------------------------------------------
* Definitions for initial stack pointer and data area (in DPRAM)
- */
-#define CONFIG_SYS_INIT_RAM_ADDR 0x20000000
-#define CONFIG_SYS_INIT_RAM_END 0x10000 /* End of used area in internal SRAM */
-#define CONFIG_SYS_GBL_DATA_SIZE 64 /* size in bytes reserved for initial data */
-#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END - CONFIG_SYS_GBL_DATA_SIZE)
+ *-----------------------------------------------------------------------*/
+
+#define CONFIG_SYS_INIT_RAM_ADDR 0x20000000
+#define CONFIG_SYS_INIT_RAM_END 0x10000
+#define CONFIG_SYS_GBL_DATA_SIZE 64
+#define CONFIG_SYS_GBL_DATA_OFFSET \
+ (CONFIG_SYS_INIT_RAM_END - CONFIG_SYS_GBL_DATA_SIZE)
#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET
/*-----------------------------------------------------------------------
@@ -171,16 +167,9 @@
#define CONFIG_SYS_SDRAM_BASE1 0x00000000
#define CONFIG_SYS_SDRAM_SIZE1 16 /* SDRAM size in MB */
-/*
-#define CONFIG_SYS_SDRAM_BASE0 CONFIG_SYS_SDRAM_BASE1+CONFIG_SYS_SDRAM_SIZE1*1024*1024
-#define CONFIG_SYS_SDRAM_SIZE0 16 */ /* SDRAM size in MB */
-
#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_SDRAM_BASE1
#define CONFIG_SYS_SDRAM_SIZE CONFIG_SYS_SDRAM_SIZE1
-#define CONFIG_SYS_FLASH_BASE CONFIG_SYS_CS0_BASE
-#define CONFIG_SYS_INT_FLASH_BASE 0xF0000000
-#define CONFIG_SYS_INT_FLASH_ENABLE 0x21
/* If M5282 port is fully implemented the monitor base will be behind
* the vector table. */
@@ -204,6 +193,11 @@
/*-----------------------------------------------------------------------
* FLASH organization
*/
+
+#define CONFIG_SYS_FLASH_BASE CONFIG_SYS_CS0_BASE
+#define CONFIG_SYS_INT_FLASH_BASE 0xF0000000
+#define CONFIG_SYS_INT_FLASH_ENABLE 0x21
+
#define CONFIG_SYS_MAX_FLASH_SECT 35
#define CONFIG_SYS_MAX_FLASH_BANKS 2
#define CONFIG_SYS_FLASH_ERASE_TOUT 10000000
@@ -251,11 +245,66 @@
#define CONFIG_SYS_PJPAR 0xFF
/*-----------------------------------------------------------------------
- * CCM configuration
+ * VIDEO configuration
*/
-#define CONFIG_SYS_CCM_SIZ 0
+#define CONFIG_VIDEO
-/*---------------------------------------------------------------------*/
+#ifdef CONFIG_VIDEO
+#define CONFIG_VIDEO_VCXK 1
+
+#define CONFIG_SYS_VCXK_DEFAULT_LINEALIGN 2
+#define CONFIG_SYS_VCXK_DOUBLEBUFFERED 1
+#define CONFIG_SYS_VCXK_BASE CONFIG_SYS_CS3_BASE
+#define CONFIG_SYS_VCXK_AUTODETECT 1
+
+#define VIDEO_ACKNOWLEDGE_PORT MCFGPTB_GPTPORT
+#define VIDEO_ACKNOWLEDGE_DDR MCFGPTB_GPTDDR
+#define VIDEO_ACKNOWLEDGE_PIN 0x0001
+
+#define VIDEO_ENABLE_PORT MCFGPTB_GPTPORT
+#define VIDEO_ENABLE_DDR MCFGPTB_GPTDDR
+#define VIDEO_ENABLE_PIN 0x0002
+
+#define VIDEO_REQUEST_PORT MCFGPTB_GPTPORT
+#define VIDEO_REQUEST_DDR MCFGPTB_GPTDDR
+#define VIDEO_REQUEST_PIN 0x0004
+
+#define VIDEO_Invert_CFG MCFGPIO_PEPAR
+#define VIDEO_Invert_IO MCFGPIO_PEPAR_PEPA2
+#define VIDEO_INVERT_PORT MCFGPIO_PORTE
+#define VIDEO_INVERT_DDR MCFGPIO_DDRE
+#define VIDEO_INVERT_PIN MCFGPIO_PORT2
+
+#define CONFIG_SYS_VCXK_RESET_INIT
+
+#define CONFIG_SYS_VCXK_INVERT_INIT \
+ MCFCCM_CCR &= ~MCFCCM_CCR_SZEN; \
+ VIDEO_Invert_CFG &= ~VIDEO_Invert_IO; \
+ VIDEO_INVERT_PORT |= VIDEO_INVERT_PIN; \
+ VIDEO_INVERT_DDR |= VIDEO_INVERT_PIN;
+
+#define CONFIG_SYS_VCXK_REQUEST \
+ VIDEO_REQUEST_PORT &= ~VIDEO_REQUEST_PIN; \
+ VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN;
+
+#define CONFIG_SYS_VCXK_REQUEST_INIT \
+ VIDEO_REQUEST_PORT |= VIDEO_REQUEST_PIN; \
+ VIDEO_REQUEST_DDR |= VIDEO_REQUEST_PIN;
+
+#define CONFIG_SYS_VCXK_ACKNOWLEDGE_INIT \
+ VIDEO_ACKNOWLEDGE_DDR &= ~VIDEO_ACKNOWLEDGE_PIN;
+#define CONFIG_SYS_VCXK_ACKNOWLEDGE \
+ (!(VIDEO_ACKNOWLEDGE_PORT & VIDEO_ACKNOWLEDGE_PIN))
+
+#define CONFIG_SYS_VCXK_DISABLE \
+ VIDEO_ENABLE_PORT |= VIDEO_ENABLE_PIN;
+#define CONFIG_SYS_VCXK_ENABLE \
+ VIDEO_ENABLE_PORT &= ~VIDEO_ENABLE_PIN;
+#define CONFIG_SYS_VCXK_ENABLE_INIT \
+ VIDEO_ENABLE_PORT |= VIDEO_ENABLE_PIN; \
+ VIDEO_ENABLE_DDR |= VIDEO_ENABLE_PIN;
+
+#endif /* CONFIG_VIDEO */
#endif /* _CONFIG_M5282EVB_H */
/*---------------------------------------------------------------------*/
3
5
Kirkwood family controllers are highly integrated SOCs
based on Feroceon-88FR131/Sheeva-88SV131 cpu core.
SOC versions supported:-
1) 88F6281-A0 define CONFIG_KW88F6281_A0
2) 88F6192-A0 define CONFIG_KW88F6192_A0
Other supported features:-
1) get_random_hex() fucntion
2) SPI port controller driver
3) PCI Express port initialization
Contributors:
Yotam Admon <yotam(a)marvell.com>
Michael Blostein <michaelbl(a)marvell.com
Reviewed-by: Ronen Shitrit <rshitrit(a)marvell.com>
Signed-off-by: Prafulla Wadaskar <prafulla(a)marvell.com>
---
Change log:
v2: crated arch-kirkwood and moved some header files there
renamed and moved spi.c to drivers/spi/
renamed and moved serial.c to drivers/serial/
doimage utility removed
soc_init.S renamed as lowlevel_init.S
debug prints removed
v3: lowlevel_init.S converted to lowlevel_init.c
removed BITxx macros, removed entire assembly code
Added CONFIG_ARCH_LOWLEVE_INIT support for arm926ejs core
updated as per review commens for v2
v4: updated as per review comments for v3
print_cpuinfo used to display Soc info
arch_misc_init support created and used for lib_arm
mandatory readl/write macros used
asm/cache.h asm/arch/spi.h asm//arch/serial.h created and used
v5: updated as per review comments for v4
cosmetic updates, arch_misc_init and arch_cpu_init used
start.S updated to call arch_lowlevel_init in case if lowlevl_init is skipped
bug fix in cpu.c
v6: lowlevel_init.S removed code moved under arch_cpu_init
v7: include <asm/arch/kirkwood.h> added to each c file
reference removed from include/asm/config.h
arch_misc_init defination kept as it is in include/common.h
bugfixed in get_random_hex function
v7.1: u-boot.lds moved from board specific to kirkwood
v8: mpp configuration added
u-boot.lsd and config.mk removed
serial driver removed and used ns16550
register offsets replaced by c struct
updated as per review comments for v7
v9: updated as per v8 review comments
removed all (u32) typecasts
spi driver bugfix and magic constants removed
tabs used for all indentation
v10: struct for nand flash registers added
cpu/arm926ejs/kirkwood/Makefile | 49 +++++
cpu/arm926ejs/kirkwood/cpu.c | 316 +++++++++++++++++++++++++++++
cpu/arm926ejs/kirkwood/dram.c | 58 ++++++
cpu/arm926ejs/kirkwood/mpp.c | 80 ++++++++
cpu/arm926ejs/kirkwood/timer.c | 168 +++++++++++++++
drivers/serial/serial.c | 3 +
drivers/spi/Makefile | 1 +
drivers/spi/kirkwood_spi.c | 185 +++++++++++++++++
include/asm-arm/arch-kirkwood/cpu.h | 149 ++++++++++++++
include/asm-arm/arch-kirkwood/kirkwood.h | 69 +++++++
include/asm-arm/arch-kirkwood/kw88f6192.h | 37 ++++
include/asm-arm/arch-kirkwood/kw88f6281.h | 37 ++++
include/asm-arm/arch-kirkwood/mpp.h | 303 +++++++++++++++++++++++++++
include/asm-arm/arch-kirkwood/spi.h | 56 +++++
include/asm-arm/cache.h | 41 ++++
include/common.h | 1 +
lib_arm/board.c | 4 +
17 files changed, 1557 insertions(+), 0 deletions(-)
create mode 100644 cpu/arm926ejs/kirkwood/Makefile
create mode 100644 cpu/arm926ejs/kirkwood/cpu.c
create mode 100644 cpu/arm926ejs/kirkwood/dram.c
create mode 100644 cpu/arm926ejs/kirkwood/mpp.c
create mode 100644 cpu/arm926ejs/kirkwood/timer.c
create mode 100644 drivers/spi/kirkwood_spi.c
create mode 100644 include/asm-arm/arch-kirkwood/cpu.h
create mode 100644 include/asm-arm/arch-kirkwood/kirkwood.h
create mode 100644 include/asm-arm/arch-kirkwood/kw88f6192.h
create mode 100644 include/asm-arm/arch-kirkwood/kw88f6281.h
create mode 100644 include/asm-arm/arch-kirkwood/mpp.h
create mode 100644 include/asm-arm/arch-kirkwood/spi.h
create mode 100644 include/asm-arm/cache.h
diff --git a/cpu/arm926ejs/kirkwood/Makefile b/cpu/arm926ejs/kirkwood/Makefile
new file mode 100644
index 0000000..b966ea1
--- /dev/null
+++ b/cpu/arm926ejs/kirkwood/Makefile
@@ -0,0 +1,49 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Prafulla Wadaskar <prafulla(a)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$(SOC).a
+
+COBJS-y = dram.o
+COBJS-y += cpu.o
+COBJS-y += mpp.o
+COBJS-y += timer.o
+
+SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all: $(obj).depend $(LIB)
+
+$(LIB): $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/cpu/arm926ejs/kirkwood/cpu.c b/cpu/arm926ejs/kirkwood/cpu.c
new file mode 100644
index 0000000..1286cac
--- /dev/null
+++ b/cpu/arm926ejs/kirkwood/cpu.c
@@ -0,0 +1,316 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)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 <netdev.h>
+#include <asm/cache.h>
+#include <u-boot/md5.h>
+#include <asm/arch/kirkwood.h>
+
+#define BUFLEN 16
+
+void reset_cpu(unsigned long ignored)
+{
+ struct kwcpu_registers *cpureg =
+ (struct kwcpu_registers *)KW_CPU_REG_BASE;
+
+ writel(readl(&cpureg->rstoutn_mask) | (1 << 2),
+ &cpureg->rstoutn_mask);
+ writel(readl(&cpureg->sys_soft_rst) | 1,
+ &cpureg->sys_soft_rst);
+ while (1) ;
+}
+
+/*
+ * Generates Ramdom hex number reading some time varient system registers
+ * and using md5 algorithm
+ */
+unsigned char get_random_hex(void)
+{
+ int i;
+ u32 inbuf[BUFLEN];
+ u8 outbuf[BUFLEN];
+
+ /*
+ * in case of 88F6281/88F6192 A0,
+ * Bit7 need to reset to generate random values in KW_REG_UNDOC_0x1470
+ * Soc reg offsets KW_REG_UNDOC_0x1470 and KW_REG_UNDOC_0x1478 are reserved regs and
+ * Does not have names at this moment (no errata available)
+ */
+ writel(readl(KW_REG_UNDOC_0x1478) & ~(1 << 7), KW_REG_UNDOC_0x1478);
+ for (i = 0; i < BUFLEN; i++) {
+ inbuf[i] = readl(KW_REG_UNDOC_0x1470);
+ }
+ md5((u8 *) inbuf, (BUFLEN * sizeof(u32)), outbuf);
+ return outbuf[outbuf[7] % 0x0f];
+}
+
+/*
+ * Window Size
+ * Used with the Base register to set the address window size and location.
+ * Must be programmed from LSB to MSB as sequence of 1’s followed by
+ * sequence of 0’s. The number of 1’s specifies the size of the window in
+ * 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte).
+ * NOTE: A value of 0x0 specifies 64-KByte size.
+ */
+static unsigned int kw_winctrl_calcsize(unsigned int sizeval)
+{
+ int i;
+ unsigned int j = 0;
+
+ for (i = 0; i < (sizeval / 0x10000); i++)
+ j |= (1 << i);
+
+ return (0x0000ffff & j);
+}
+
+/* prepares data to be loaded in win_Ctrl register */
+#define KWCPU_WIN_CTRL_DATA(size, target, attr, en) (en | (target << 4) \
+ | (attr << 8) | (kw_winctrl_calcsize(size) << 16))
+
+/*
+ * kw_config_adr_windows - Configure address Windows
+ *
+ * There are 7 address windows supported by Kirkwood Soc to addess different
+ * devices. Each window can be configured for size, BAR and remap addr
+ * Below configuration is standard for most of the cases
+ *
+ * Reference Documentation:
+ * Mbus-L to Mbus Bridge Registers Configuration.
+ * (Sec 25.1 and 25.3 of Datasheet)
+ */
+int kw_config_adr_windows(void)
+{
+ struct kwwin_registers *winregs =
+ (struct kwwin_registers *)KW_CPU_WIN_BASE;
+
+ writel(KWCPU_WIN_CTRL_DATA(0xc0000, KWCPU_TARGET_PCIE,
+ KWCPU_ATTR_PCIE_MEM, KWCPU_WIN_ENABLE),
+ &winregs[0].ctrl);
+
+ writel(0x90000000, &winregs[0].base);
+ writel(0x90000000, &winregs[0].remap_lo);
+ writel(0x00000000, &winregs[0].remap_hi);
+
+ writel(KWCPU_WIN_CTRL_DATA(0x70000, KWCPU_TARGET_MEMORY,
+ KWCPU_ATTR_NANDFLASH, KWCPU_WIN_ENABLE),
+ &winregs[1].ctrl);
+ writel(0xF9000000, &winregs[1].base);
+ writel(0xF9000000, &winregs[1].remap_lo);
+ writel(0x00000000, &winregs[1].remap_hi);
+
+ writel(KWCPU_WIN_CTRL_DATA(0x80000, KWCPU_TARGET_PCIE,
+ KWCPU_ATTR_PCIE_IO, KWCPU_WIN_ENABLE),
+ &winregs[2].ctrl);
+ writel(0xF0000000, &winregs[2].base);
+ writel(0xC0000000, &winregs[2].remap_lo);
+ writel(0x00000000, &winregs[2].remap_hi);
+
+ writel(KWCPU_WIN_CTRL_DATA(0x80000, KWCPU_TARGET_MEMORY,
+ KWCPU_ATTR_SPIFLASH, KWCPU_WIN_ENABLE),
+ &winregs[3].ctrl);
+ writel(0xF8000000, &winregs[3].base);
+ writel(0x00000000, &winregs[3].remap_lo);
+ writel(0x00000000, &winregs[3].remap_hi);
+
+ writel(KWCPU_WIN_CTRL_DATA(0x80000, KWCPU_TARGET_MEMORY,
+ KWCPU_ATTR_BOOTROM, KWCPU_WIN_ENABLE),
+ &winregs[4].ctrl);
+ writel(0xFF000000, &winregs[4].base);
+ writel(0x00000000, &winregs[4].remap_lo);
+ writel(0x00000000, &winregs[4].remap_hi);
+
+ writel(KWCPU_WIN_CTRL_DATA(0xb0000, KWCPU_TARGET_MEMORY,
+ KWCPU_ATTR_SPIFLASH, KWCPU_WIN_DISABLE),
+ &winregs[5].ctrl);
+ writel(0xE8000000, &winregs[5].base);
+ writel(0x00000000, &winregs[5].remap_lo);
+ writel(0x00000000, &winregs[5].remap_hi);
+
+ writel(KWCPU_WIN_CTRL_DATA(0xb0000, KWCPU_TARGET_MEMORY,
+ KWCPU_ATTR_BOOTROM, KWCPU_WIN_DISABLE),
+ &winregs[6].ctrl);
+ writel(0xF0000000, &winregs[6].base);
+ writel(0x00000000, &winregs[6].remap_lo);
+ writel(0x00000000, &winregs[6].remap_hi);
+
+ writel(KWCPU_WIN_CTRL_DATA(0x0, KWCPU_TARGET_SASRAM, KWCPU_ATTR_SASRAM,
+ KWCPU_WIN_ENABLE), &winregs[7].ctrl);
+ writel(0xFB000000, &winregs[7].base);
+ writel(0x00000000, &winregs[7].remap_lo);
+ writel(0x00000000, &winregs[7].remap_hi);
+
+ return 0;
+}
+
+/*
+ * kw_config_gpio - GPIO configuration
+ */
+void kw_config_gpio(u32 gpp0_oe_val, u32 gpp1_oe_val, u32 gpp0_oe, u32 gpp1_oe)
+{
+ struct kwgpio_registers *gpio0reg =
+ (struct kwgpio_registers *)KW_GPIO0_BASE;
+ struct kwgpio_registers *gpio1reg =
+ (struct kwgpio_registers *)KW_GPIO1_BASE;
+
+ /* Init GPIOS to default values as per board requirement */
+ writel(gpp0_oe_val, &gpio0reg->dout);
+ writel(gpp1_oe_val, &gpio1reg->dout);
+ writel(gpp0_oe, &gpio0reg->oe);
+ writel(gpp1_oe, &gpio1reg->oe);
+}
+
+/*
+ * kw_config_mpp - Multi-Purpose Pins Functionality configuration
+ *
+ * Each MPP can be configured to different functionality through
+ * MPP control register, ref (sec 6.1 of kirkwood h/w specification)
+ *
+ * There are maximum 64 Multi-Pourpose Pins on Kirkwood
+ * Each MPP functionality can be configuration by a 4bit value
+ * of MPP control reg, the value and associated functionality depends
+ * upon used SoC varient
+ */
+int kw_config_mpp(u32 mpp0_7, u32 mpp8_15, u32 mpp16_23, u32 mpp24_31,
+ u32 mpp32_39, u32 mpp40_47, u32 mpp48_55)
+{
+ u32 *mppreg = (u32 *) KW_MPP_BASE;
+
+ /* program mpp registers */
+ writel(mpp0_7, &mppreg[0]);
+ writel(mpp8_15, &mppreg[1]);
+ writel(mpp16_23, &mppreg[2]);
+ writel(mpp24_31, &mppreg[3]);
+ writel(mpp32_39, &mppreg[4]);
+ writel(mpp40_47, &mppreg[5]);
+ writel(mpp48_55, &mppreg[6]);
+ return 0;
+}
+
+#if defined(CONFIG_DISPLAY_CPUINFO)
+int print_cpuinfo(void)
+{
+ char *name = "Unknown";
+
+ switch (readl(KW_REG_DEVICE_ID) & 0x03) {
+ case 1:
+ name = "88F6192_A0";
+ break;
+ case 2:
+ name = "88F6281_A0";
+ break;
+ default:
+ printf("SoC: Unsupported Kirkwood\n");
+ return -1;
+ }
+ printf("SoC: Kirkwood %s\n", name);
+ return 0;
+}
+#endif /* CONFIG_DISPLAY_CPUINFO */
+
+#ifdef CONFIG_ARCH_CPU_INIT
+int arch_cpu_init(void)
+{
+ u32 reg;
+ struct kwcpu_registers *cpureg =
+ (struct kwcpu_registers *)KW_CPU_REG_BASE;
+
+ /* Linux expects` the internal registers to be at 0xf1000000 */
+ writel(KW_REGS_PHY_BASE, KW_OFFSET_REG);
+
+ /* Enable and invalidate L2 cache in write through mode */
+ writel(readl(&cpureg->l2_cfg) | 0x18, &cpureg->l2_cfg);
+ invalidate_l2_cache();
+
+ kw_config_adr_windows();
+
+#ifdef CONFIG_KIRKWOOD_RGMII_PAD_1V8
+ /*
+ * Configures the I/O voltage of the pads connected to Egigabit
+ * Ethernet interface to 1.8V
+ * By defult it is set to 3.3V
+ */
+ reg = readl(KW_REG_MPP_OUT_DRV_REG);
+ reg |= (1 << 7);
+ writel(reg, KW_REG_MPP_OUT_DRV_REG);
+#endif
+#ifdef CONFIG_KIRKWOOD_EGIGA_INIT
+ /*
+ * Set egiga port0/1 in normal functional mode
+ * This is required becasue on kirkwood by default ports are in reset mode
+ * OS egiga driver may not have provision to set them in normal mode
+ * and if u-boot is build without network support, network may fail at OS level
+ */
+ reg = readl(KWGBE_PORT_SERIAL_CONTROL1_REG(0));
+ reg &= ~(1 << 4); /* Clear PortReset Bit */
+ writel(reg, (KWGBE_PORT_SERIAL_CONTROL1_REG(0)));
+ reg = readl(KWGBE_PORT_SERIAL_CONTROL1_REG(1));
+ reg &= ~(1 << 4); /* Clear PortReset Bit */
+ writel(reg, (KWGBE_PORT_SERIAL_CONTROL1_REG(1)));
+#endif
+#ifdef CONFIG_KIRKWOOD_PCIE_INIT
+ /*
+ * Enable PCI Express Port0
+ */
+ reg = readl(&cpureg->ctrl_stat);
+ reg |= (1 << 0); /* Set PEX0En Bit */
+ writel(reg, &cpureg->ctrl_stat);
+#endif
+ return 0;
+}
+#endif /* CONFIG_ARCH_CPU_INIT */
+
+/*
+ * SOC specific misc init
+ */
+#if defined(CONFIG_ARCH_MISC_INIT)
+int arch_misc_init(void)
+{
+ volatile u32 temp;
+
+ /*CPU streaming & write allocate */
+ temp = readfr_extra_feature_reg();
+ temp &= ~(1 << 28); /* disable wr alloc */
+ writefr_extra_feature_reg(temp);
+
+ temp = readfr_extra_feature_reg();
+ temp &= ~(1 << 29); /* streaming disabled */
+ writefr_extra_feature_reg(temp);
+
+ /* L2Cache settings */
+ temp = readfr_extra_feature_reg();
+ /* Disable L2C pre fetch - Set bit 24 */
+ temp |= (1 << 24);
+ /* enable L2C - Set bit 22 */
+ temp |= (1 << 22);
+ writefr_extra_feature_reg(temp);
+
+ icache_enable();
+ /* Change reset vector to address 0x0 */
+ temp = get_cr();
+ set_cr(temp & ~CR_V);
+
+ return 0;
+}
+#endif /* CONFIG_ARCH_MISC_INIT */
diff --git a/cpu/arm926ejs/kirkwood/dram.c b/cpu/arm926ejs/kirkwood/dram.c
new file mode 100644
index 0000000..3ec0548
--- /dev/null
+++ b/cpu/arm926ejs/kirkwood/dram.c
@@ -0,0 +1,58 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)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 <config.h>
+#include <asm/arch/kirkwood.h>
+
+#define KW_REG_CPUCS_WIN_BAR(x) (KW_REGISTER(0x1500) + (x * 0x08))
+#define KW_REG_CPUCS_WIN_SZ(x) (KW_REGISTER(0x1504) + (x * 0x08))
+/*
+ * kw_sdram_bar - reads SDRAM Base Address Register
+ */
+u32 kw_sdram_bar(enum memory_bank bank)
+{
+ u32 result = 0;
+ u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
+
+ if ((!enable) || (bank > BANK3))
+ return 0;
+
+ result = readl(KW_REG_CPUCS_WIN_BAR(bank));
+ return result;
+}
+
+/*
+ * kw_sdram_bs - reads SDRAM Bank size
+ */
+u32 kw_sdram_bs(enum memory_bank bank)
+{
+ u32 result = 0;
+ u32 enable = 0x01 & readl(KW_REG_CPUCS_WIN_SZ(bank));
+
+ if ((!enable) || (bank > BANK3))
+ return 0;
+ result = 0xff000000 & readl(KW_REG_CPUCS_WIN_SZ(bank));
+ result += 0x01000000;
+ return result;
+}
diff --git a/cpu/arm926ejs/kirkwood/mpp.c b/cpu/arm926ejs/kirkwood/mpp.c
new file mode 100644
index 0000000..b2f0ad5
--- /dev/null
+++ b/cpu/arm926ejs/kirkwood/mpp.c
@@ -0,0 +1,80 @@
+/*
+ * arch/arm/mach-kirkwood/mpp.c
+ *
+ * MPP functions for Marvell Kirkwood SoCs
+ * Referenced from Linux kernel source
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <common.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/mpp.h>
+
+static u32 kirkwood_variant(void)
+{
+ switch (readl(KW_REG_DEVICE_ID) & 0x03) {
+ case 1:
+ return MPP_F6192_MASK;
+ case 2:
+ return MPP_F6281_MASK;
+ default:
+ debug("MPP setup: unknown kirkwood variant\n");
+ return 0;
+ }
+}
+
+#define MPP_CTRL(i) (KW_MPP_BASE + (i* 4))
+#define MPP_NR_REGS (1 + MPP_MAX/8)
+
+void kirkwood_mpp_conf(u32 *mpp_list)
+{
+ u32 mpp_ctrl[MPP_NR_REGS];
+ unsigned int variant_mask;
+ int i;
+
+ variant_mask = kirkwood_variant();
+ if (!variant_mask)
+ return;
+
+ debug( "initial MPP regs:");
+ for (i = 0; i < MPP_NR_REGS; i++) {
+ mpp_ctrl[i] = readl(MPP_CTRL(i));
+ debug(" %08x", mpp_ctrl[i]);
+ }
+ debug("\n");
+
+
+ while (*mpp_list) {
+ unsigned int num = MPP_NUM(*mpp_list);
+ unsigned int sel = MPP_SEL(*mpp_list);
+ int shift;
+
+ if (num > MPP_MAX) {
+ debug("kirkwood_mpp_conf: invalid MPP "
+ "number (%u)\n", num);
+ continue;
+ }
+ if (!(*mpp_list & variant_mask)) {
+ debug("kirkwood_mpp_conf: requested MPP%u config "
+ "unavailable on this hardware\n", num);
+ continue;
+ }
+
+ shift = (num & 7) << 2;
+ mpp_ctrl[num / 8] &= ~(0xf << shift);
+ mpp_ctrl[num / 8] |= sel << shift;
+
+ mpp_list++;
+ }
+
+ debug(" final MPP regs:");
+ for (i = 0; i < MPP_NR_REGS; i++) {
+ writel(mpp_ctrl[i], MPP_CTRL(i));
+ debug(" %08x", mpp_ctrl[i]);
+ }
+ debug("\n");
+
+}
diff --git a/cpu/arm926ejs/kirkwood/timer.c b/cpu/arm926ejs/kirkwood/timer.c
new file mode 100644
index 0000000..5c39ee8
--- /dev/null
+++ b/cpu/arm926ejs/kirkwood/timer.c
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) Marvell International Ltd. and its affiliates
+ * Prafulla Wadaskar <prafulla(a)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 <asm/arch/kirkwood.h>
+
+#define UBOOT_CNTR 0 /* counter to use for uboot timer */
+
+/* Timer reload and current value registers */
+struct kwtmr_val {
+ u32 reload; /* Timer reload reg */
+ u32 val; /* Timer value reg */
+};
+
+/* Timer registers */
+struct kwtmr_registers {
+ u32 ctrl; /* Timer control reg */
+ u32 pad[3];
+ struct kwtmr_val tmr[2];
+ u32 wdt_reload;
+ u32 wdt_val;
+};
+
+struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers *)KW_TIMER_BASE;
+
+/*
+ * ARM Timers Registers Map
+ */
+#define CNTMR_CTRL_REG &kwtmr_regs->ctrl
+#define CNTMR_RELOAD_REG(tmrnum) &kwtmr_regs->tmr[tmrnum].reload
+#define CNTMR_VAL_REG(tmrnum) &kwtmr_regs->tmr[tmrnum].val
+
+/*
+ * ARM Timers Control Register
+ * CPU_TIMERS_CTRL_REG (CTCR)
+ */
+#define CTCR_ARM_TIMER_EN_OFFS(cntr) (cntr * 2)
+#define CTCR_ARM_TIMER_EN_MASK(cntr) (1 << CTCR_ARM_TIMER_EN_OFFS)
+#define CTCR_ARM_TIMER_EN(cntr) (1 << CTCR_ARM_TIMER_EN_OFFS(cntr))
+#define CTCR_ARM_TIMER_DIS(cntr) (0 << CTCR_ARM_TIMER_EN_OFFS(cntr))
+
+#define CTCR_ARM_TIMER_AUTO_OFFS(cntr) ((cntr * 2) + 1)
+#define CTCR_ARM_TIMER_AUTO_MASK(cntr) (1 << 1)
+#define CTCR_ARM_TIMER_AUTO_EN(cntr) (1 << CTCR_ARM_TIMER_AUTO_OFFS(cntr))
+#define CTCR_ARM_TIMER_AUTO_DIS(cntr) (0 << CTCR_ARM_TIMER_AUTO_OFFS(cntr))
+
+/*
+ * ARM Timer\Watchdog Reload Register
+ * CNTMR_RELOAD_REG (TRR)
+ */
+#define TRG_ARM_TIMER_REL_OFFS 0
+#define TRG_ARM_TIMER_REL_MASK 0xffffffff
+
+/*
+ * ARM Timer\Watchdog Register
+ * CNTMR_VAL_REG (TVRG)
+ */
+#define TVR_ARM_TIMER_OFFS 0
+#define TVR_ARM_TIMER_MASK 0xffffffff
+#define TVR_ARM_TIMER_MAX 0xffffffff
+#define TIMER_LOAD_VAL 0xffffffff
+
+#define READ_TIMER (readl(CNTMR_VAL_REG(UBOOT_CNTR)) / \
+ (CONFIG_SYS_TCLK / 1000))
+
+static ulong timestamp;
+static ulong lastdec;
+
+void reset_timer_masked(void)
+{
+ /* reset time */
+ lastdec = READ_TIMER;
+ timestamp = 0;
+}
+
+ulong get_timer_masked(void)
+{
+ ulong now = READ_TIMER;
+
+ if (lastdec >= now) {
+ /* normal mode */
+ timestamp += lastdec - now;
+ } else {
+ /* we have an overflow ... */
+ timestamp += lastdec +
+ (TIMER_LOAD_VAL / (CONFIG_SYS_TCLK / 1000)) - now;
+ }
+ lastdec = now;
+
+ return timestamp;
+}
+
+void reset_timer(void)
+{
+ reset_timer_masked();
+}
+
+ulong get_timer(ulong base)
+{
+ return get_timer_masked() - base;
+}
+
+void set_timer(ulong t)
+{
+ timestamp = t;
+}
+
+void udelay(unsigned long usec)
+{
+ uint current;
+ ulong delayticks;
+
+ current = readl(CNTMR_VAL_REG(UBOOT_CNTR));
+ delayticks = (usec * (CONFIG_SYS_TCLK / 1000000));
+
+ if (current < delayticks) {
+ delayticks -= current;
+ while (readl(CNTMR_VAL_REG(UBOOT_CNTR)) < current) ;
+ while ((TIMER_LOAD_VAL - delayticks) <
+ readl(CNTMR_VAL_REG(UBOOT_CNTR))) ;
+ } else {
+ while (readl(CNTMR_VAL_REG(UBOOT_CNTR)) >
+ (current - delayticks)) ;
+ }
+}
+
+/*
+ * init the counter
+ */
+int timer_init(void)
+{
+ unsigned int cntmrctrl;
+
+ /* load value into timer */
+ writel(TIMER_LOAD_VAL, CNTMR_RELOAD_REG(UBOOT_CNTR));
+ writel(TIMER_LOAD_VAL, CNTMR_VAL_REG(UBOOT_CNTR));
+
+ /* enable timer in auto reload mode */
+ cntmrctrl = readl(CNTMR_CTRL_REG);
+ cntmrctrl |= CTCR_ARM_TIMER_EN(UBOOT_CNTR);
+ cntmrctrl |= CTCR_ARM_TIMER_AUTO_EN(UBOOT_CNTR);
+ writel(cntmrctrl, CNTMR_CTRL_REG);
+
+ /* init the timestamp and lastdec value */
+ reset_timer_masked();
+
+ return 0;
+}
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 966df9a..dd5f332 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -27,6 +27,9 @@
#ifdef CONFIG_NS87308
#include <ns87308.h>
#endif
+#ifdef CONFIG_KIRKWOOD
+#include <asm/arch/kirkwood.h>
+#endif
#if defined (CONFIG_SERIAL_MULTI)
#include <serial.h>
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 1350f3e..7ffa47d 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -28,6 +28,7 @@ LIB := $(obj)libspi.a
COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
+COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
new file mode 100644
index 0000000..9d16e9b
--- /dev/null
+++ b/drivers/spi/kirkwood_spi.c
@@ -0,0 +1,185 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)marvell.com>
+ *
+ * Derived from drivers/spi/mpc8xxx_spi.c
+ *
+ * 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 <malloc.h>
+#include <spi.h>
+#include <asm/arch/kirkwood.h>
+#include <asm/arch/spi.h>
+#include <asm/arch/mpp.h>
+
+static struct kwspi_registers *spireg = (struct kwspi_registers *)KW_SPI_BASE;
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+ unsigned int max_hz, unsigned int mode)
+{
+ struct spi_slave *slave;
+ u32 data;
+ u32 kwspi_mpp_config[] = {
+ MPP0_GPIO,
+ MPP7_SPI_SCn,
+ 0
+ };
+
+ if (!spi_cs_is_valid(bus, cs))
+ return NULL;
+
+ slave = malloc(sizeof(struct spi_slave));
+ if (!slave)
+ return NULL;
+
+ slave->bus = bus;
+ slave->cs = cs;
+
+ writel(~KWSPI_CSN_ACT | KWSPI_SMEMRDY, &spireg->ctrl);
+
+ /* calculate spi clock prescaller using max_hz */
+ data = ((CONFIG_SYS_TCLK / 2) / max_hz) & KWSPI_CLKPRESCL_MASK;
+ data |= 0x10;
+
+ /* program spi clock prescaller using max_hz */
+ writel(KWSPI_ADRLEN_3BYTE | data, &spireg->cfg);
+ debug("data = 0x%08x \n", data);
+
+ writel(KWSPI_SMEMRDIRQ, &spireg->irq_cause);
+ writel(KWSPI_IRQMASK, spireg->irq_mask);
+
+ /* program mpp registers to select SPI_CSn */
+ if (cs) {
+ kwspi_mpp_config[0] = MPP0_GPIO;
+ kwspi_mpp_config[1] = MPP7_SPI_SCn;
+ } else {
+ kwspi_mpp_config[0] = MPP0_SPI_SCn;
+ kwspi_mpp_config[1] = MPP7_GPO;
+ }
+ kirkwood_mpp_conf(kwspi_mpp_config);
+
+ return slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+ free(slave);
+}
+
+int spi_claim_bus(struct spi_slave *slave)
+{
+ return 0;
+}
+
+void spi_release_bus(struct spi_slave *slave)
+{
+}
+
+#ifndef CONFIG_SPI_CS_IS_VALID
+/*
+ * you can define this function board specific
+ * define above CONFIG in board specific config file and
+ * provide the function in board specific src file
+ */
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+ return (bus == 0 && (cs == 0 || cs == 1));
+}
+#endif
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+ writel(readl(&spireg->ctrl) | KWSPI_IRQUNMASK, &spireg->ctrl);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+ writel(readl(&spireg->ctrl) & KWSPI_IRQMASK, &spireg->ctrl);
+}
+
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
+ void *din, unsigned long flags)
+{
+ unsigned int tmpdout, tmpdin;
+ int tm, isread = 0;
+
+ debug("spi_xfer: slave %u:%u dout %08X din %08X bitlen %u\n",
+ slave->bus, slave->cs, dout, din, bitlen);
+
+ if (flags & SPI_XFER_BEGIN)
+ spi_cs_activate(slave);
+
+ /*
+ * handle data in 8-bit chunks
+ * TBD: 2byte xfer mode to be enabled
+ */
+ writel(((readl(&spireg->cfg) & ~KWSPI_XFERLEN_MASK) |
+ KWSPI_XFERLEN_1BYTE), &spireg->cfg);
+
+ while (bitlen > 4) {
+ debug("loopstart bitlen %d\n", bitlen);
+ tmpdout = 0;
+
+ /* Shift data so it's msb-justified */
+ if (dout)
+ tmpdout = *(u32 *) dout & 0x0ff;
+
+ writel(~KWSPI_SMEMRDIRQ, &spireg->irq_cause);
+ writel(tmpdout, &spireg->dout); /* Write the data out */
+ debug("*** spi_xfer: ... %08x written, bitlen %d\n",
+ tmpdout, bitlen);
+
+ /*
+ * Wait for SPI transmit to get out
+ * or time out (1 second = 1000 ms)
+ * The NE event must be read and cleared first
+ */
+ for (tm = 0, isread = 0; tm < KWSPI_TIMEOUT; ++tm) {
+ if (readl(&spireg->irq_cause) & KWSPI_SMEMRDIRQ) {
+ isread = 1;
+ tmpdin = readl(&spireg->din);
+ debug
+ ("spi_xfer: din %08x..%08x read\n",
+ din, tmpdin);
+
+ if (din) {
+ *((u8 *) din) = (u8) tmpdin;
+ din += 1;
+ }
+ if (dout)
+ dout += 1;
+ bitlen -= 8;
+ }
+ if (isread)
+ break;
+ }
+ if (tm >= KWSPI_TIMEOUT)
+ printf("*** spi_xfer: Time out during SPI transfer\n");
+
+ debug("loopend bitlen %d\n", bitlen);
+ }
+
+ if (flags & SPI_XFER_END)
+ spi_cs_deactivate(slave);
+
+ return 0;
+}
diff --git a/include/asm-arm/arch-kirkwood/cpu.h b/include/asm-arm/arch-kirkwood/cpu.h
new file mode 100644
index 0000000..635bd8f
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/cpu.h
@@ -0,0 +1,149 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)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
+ */
+
+#ifndef _KWCPU_H
+#define _KWCPU_H
+
+#include <asm/system.h>
+
+#ifndef __ASSEMBLY__
+
+#define KWGBE_PORT_SERIAL_CONTROL1_REG(_x) \
+ ((_x ? KW_EGIGA0_BASE : KW_EGIGA1_BASE) + 0x44c)
+
+#define KW_REG_DEVICE_ID (KW_MPP_BASE + 0x34)
+#define KW_REG_MPP_OUT_DRV_REG (KW_MPP_BASE + 0xE0)
+
+enum memory_bank {
+ BANK0,
+ BANK1,
+ BANK2,
+ BANK3
+};
+
+enum kwcpu_winen {
+ KWCPU_WIN_DISABLE,
+ KWCPU_WIN_ENABLE
+};
+
+enum kwcpu_target {
+ KWCPU_TARGET_RESERVED,
+ KWCPU_TARGET_MEMORY,
+ KWCPU_TARGET_1RESERVED,
+ KWCPU_TARGET_SASRAM,
+ KWCPU_TARGET_PCIE
+};
+
+enum kwcpu_attrib {
+ KWCPU_ATTR_SASRAM = 0x01,
+ KWCPU_ATTR_NANDFLASH = 0x2f,
+ KWCPU_ATTR_SPIFLASH = 0x1e,
+ KWCPU_ATTR_BOOTROM = 0x1d,
+ KWCPU_ATTR_PCIE_IO = 0xe0,
+ KWCPU_ATTR_PCIE_MEM = 0xe8
+};
+
+/*
+ * read feroceon/sheeva core extra feature register
+ * using co-proc instruction
+ */
+static inline unsigned int readfr_extra_feature_reg(void)
+{
+ unsigned int val;
+ asm volatile ("mrc p15, 1, %0, c15, c1, 0 @ readfr exfr":"=r"
+ (val)::"cc");
+ return val;
+}
+
+/*
+ * write feroceon/sheeva core extra feature register
+ * using co-proc instruction
+ */
+static inline void writefr_extra_feature_reg(unsigned int val)
+{
+ asm volatile ("mcr p15, 1, %0, c15, c1, 0 @ writefr exfr"::"r"
+ (val):"cc");
+ isb();
+}
+
+/*
+ * Register structures
+ */
+struct kwgpio_registers {
+ u32 dout;
+ u32 oe;
+ u32 blink_en;
+ u32 din_pol;
+ u32 din;
+ u32 irq_cause;
+ u32 irq_mask;
+ u32 irq_level;
+};
+
+struct kwwin_registers {
+ u32 ctrl;
+ u32 base;
+ u32 remap_lo;
+ u32 remap_hi;
+};
+
+/* CPU control and status registers */
+struct kwcpu_registers {
+ u32 config; /*0x20100 */
+ u32 ctrl_stat; /*0x20104 */
+ u32 rstoutn_mask; /* 0x20108 */
+ u32 sys_soft_rst; /* 0x2010C */
+ u32 ahb_mbus_cause_irq; /* 0x20110 */
+ u32 ahb_mbus_mask_irq; /* 0x20114 */
+ u32 pad1[2];
+ u32 ftdll_config; /* 0x20120 */
+ u32 pad2;
+ u32 l2_cfg; /* 0x20128 */
+};
+
+/* NAND flash registers */
+struct kwnandf_registers {
+ u32 rd_params; /* 0x10418 */
+ u32 wr_param; /* 0x1041c */
+ u8 pag[0x10470 - 0x1041c -4];
+ u32 ctrl; /* 0x10470 */
+};
+
+/*
+ * functions
+ */
+void reset_cpu(unsigned long ignored);
+unsigned char get_random_hex(void);
+unsigned int kw_sdram_bar(enum memory_bank bank);
+unsigned int kw_sdram_bs(enum memory_bank bank);
+int kw_config_adr_windows(void);
+void kw_config_gpio(unsigned int gpp0_oe_val, unsigned int gpp1_oe_val,
+ unsigned int gpp0_oe, unsigned int gpp1_oe);
+int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15,
+ unsigned int mpp16_23, unsigned int mpp24_31,
+ unsigned int mpp32_39, unsigned int mpp40_47,
+ unsigned int mpp48_55);
+#endif /* __ASSEMBLY__ */
+
+#endif /* _KWCPU_H */
diff --git a/include/asm-arm/arch-kirkwood/kirkwood.h b/include/asm-arm/arch-kirkwood/kirkwood.h
new file mode 100644
index 0000000..f026b9c
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/kirkwood.h
@@ -0,0 +1,69 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)marvell.com>
+ *
+ * Header file for the Marvell's Feroceon CPU core.
+ *
+ * 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
+ */
+
+#ifndef _ASM_ARCH_KIRKWOOD_H
+#define _ASM_ARCH_KIRKWOOD_H
+
+#ifndef __ASSEMBLY__
+#include <asm/types.h>
+#include <asm/io.h>
+#endif /* __ASSEMBLY__ */
+
+#if defined (CONFIG_FEROCEON_88FR131) || defined (CONFIG_SHEEVA_88SV131)
+#include <asm/arch/cpu.h>
+
+/* SOC specific definations */
+#define INTREG_BASE 0xd0000000
+#define KW_REGISTER(x) (KW_REGS_PHY_BASE + x)
+#define KW_OFFSET_REG (INTREG_BASE + 0x20080)
+
+/* undocumented registers */
+#define KW_REG_UNDOC_0x1470 (KW_REGISTER(0x1470))
+#define KW_REG_UNDOC_0x1478 (KW_REGISTER(0x1478))
+
+#define KW_UART0_BASE (KW_REGISTER(0x12000))
+#define KW_UART1_BASE (KW_REGISTER(0x13000))
+#define KW_MPP_BASE (KW_REGISTER(0x10000))
+#define KW_GPIO0_BASE (KW_REGISTER(0x10100))
+#define KW_GPIO1_BASE (KW_REGISTER(0x10140))
+#define KW_NANDF_BASE (KW_REGISTER(0x10418))
+#define KW_SPI_BASE (KW_REGISTER(0x10600))
+#define KW_CPU_WIN_BASE (KW_REGISTER(0x20000))
+#define KW_CPU_REG_BASE (KW_REGISTER(0x20100))
+#define KW_TIMER_BASE (KW_REGISTER(0x20300))
+#define KW_REG_PCIE_BASE (KW_REGISTER(0x40000))
+#define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
+#define KW_EGIGA1_BASE (KW_REGISTER(0x76000))
+
+#if defined (CONFIG_KW88F6281)
+#include <asm/arch/kw88f6281.h>
+#elif defined (CONFIG_KW88F6192)
+#include <asm/arch/kw88f6192.h>
+#else
+#error "SOC Name not defined"
+#endif /* CONFIG_KW88F6281 */
+#endif /* CONFIG_FEROCEON_88FR131 */
+#endif /* _ASM_ARCH_KIRKWOOD_H */
diff --git a/include/asm-arm/arch-kirkwood/kw88f6192.h b/include/asm-arm/arch-kirkwood/kw88f6192.h
new file mode 100644
index 0000000..a2b1f96
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/kw88f6192.h
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)marvell.com>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6192 SOC.
+ *
+ * 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
+ */
+
+#ifndef _CONFIG_KW88F6192_H
+#define _CONFIG_KW88F6192_H
+
+/* SOC specific definations */
+#define KW88F6192_REGS_PHYS_BASE 0xf1000000
+#define KW_REGS_PHY_BASE KW88F6192_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination */
+#define CONFIG_SYS_TCLK 166000000 /* 166MHz */
+
+#endif /* _CONFIG_KW88F6192_H */
diff --git a/include/asm-arm/arch-kirkwood/kw88f6281.h b/include/asm-arm/arch-kirkwood/kw88f6281.h
new file mode 100644
index 0000000..9b89b93
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/kw88f6281.h
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)marvell.com>
+ *
+ * Header file for Feroceon CPU core 88FR131 Based KW88F6281 SOC.
+ *
+ * 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
+ */
+
+#ifndef _ASM_ARCH_KW88F6281_H
+#define _ASM_ARCH_KW88F6281_H
+
+/* SOC specific definations */
+#define KW88F6281_REGS_PHYS_BASE 0xf1000000
+#define KW_REGS_PHY_BASE KW88F6281_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination*/
+#define CONFIG_SYS_TCLK 200000000 /* 200MHz */
+
+#endif /* _ASM_ARCH_KW88F6281_H */
diff --git a/include/asm-arm/arch-kirkwood/mpp.h b/include/asm-arm/arch-kirkwood/mpp.h
new file mode 100644
index 0000000..e021a80
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/mpp.h
@@ -0,0 +1,303 @@
+/*
+ * linux/arch/arm/mach-kirkwood/mpp.h -- Multi Purpose Pins
+ *
+ * Copyright 2009: Marvell Technology Group Ltd.
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __KIRKWOOD_MPP_H
+#define __KIRKWOOD_MPP_H
+
+#define MPP(_num, _sel, _in, _out, _F6180, _F6190, _F6192, _F6281) ( \
+ /* MPP number */ ((_num) & 0xff) | \
+ /* MPP select value */ (((_sel) & 0xf) << 8) | \
+ /* may be input signal */ ((!!(_in)) << 12) | \
+ /* may be output signal */ ((!!(_out)) << 13) | \
+ /* available on F6180 */ ((!!(_F6180)) << 14) | \
+ /* available on F6190 */ ((!!(_F6190)) << 15) | \
+ /* available on F6192 */ ((!!(_F6192)) << 16) | \
+ /* available on F6281 */ ((!!(_F6281)) << 17))
+
+#define MPP_NUM(x) ((x) & 0xff)
+#define MPP_SEL(x) (((x) >> 8) & 0xf)
+
+ /* num sel i o 6180 6190 6192 6281 */
+
+#define MPP_INPUT_MASK MPP( 0, 0x0, 1, 0, 0, 0, 0, 0 )
+#define MPP_OUTPUT_MASK MPP( 0, 0x0, 0, 1, 0, 0, 0, 0 )
+
+#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0 )
+#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0 )
+#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0 )
+#define MPP_F6281_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 1 )
+
+#define MPP0_GPIO MPP( 0, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP0_NF_IO2 MPP( 0, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP0_SPI_SCn MPP( 0, 0x2, 0, 1, 1, 1, 1, 1 )
+
+#define MPP1_GPO MPP( 1, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP1_NF_IO3 MPP( 1, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP1_SPI_MOSI MPP( 1, 0x2, 0, 1, 1, 1, 1, 1 )
+
+#define MPP2_GPO MPP( 2, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP2_NF_IO4 MPP( 2, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP2_SPI_SCK MPP( 2, 0x2, 0, 1, 1, 1, 1, 1 )
+
+#define MPP3_GPO MPP( 3, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP3_NF_IO5 MPP( 3, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP3_SPI_MISO MPP( 3, 0x2, 1, 0, 1, 1, 1, 1 )
+
+#define MPP4_GPIO MPP( 4, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP4_NF_IO6 MPP( 4, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP4_UART0_RXD MPP( 4, 0x2, 1, 0, 1, 1, 1, 1 )
+#define MPP4_SATA1_ACTn MPP( 4, 0x5, 0, 1, 0, 0, 1, 1 )
+#define MPP4_PTP_CLK MPP( 4, 0xd, 1, 0, 1, 1, 1, 1 )
+
+#define MPP5_GPO MPP( 5, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP5_NF_IO7 MPP( 5, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP5_UART0_TXD MPP( 5, 0x2, 0, 1, 1, 1, 1, 1 )
+#define MPP5_PTP_TRIG_GEN MPP( 5, 0x4, 0, 1, 1, 1, 1, 1 )
+#define MPP5_SATA0_ACTn MPP( 5, 0x5, 0, 1, 0, 1, 1, 1 )
+
+#define MPP6_SYSRST_OUTn MPP( 6, 0x1, 0, 1, 1, 1, 1, 1 )
+#define MPP6_SPI_MOSI MPP( 6, 0x2, 0, 1, 1, 1, 1, 1 )
+#define MPP6_PTP_TRIG_GEN MPP( 6, 0x3, 0, 1, 1, 1, 1, 1 )
+
+#define MPP7_GPO MPP( 7, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP7_PEX_RST_OUTn MPP( 7, 0x1, 0, 1, 1, 1, 1, 1 )
+#define MPP7_SPI_SCn MPP( 7, 0x2, 0, 1, 1, 1, 1, 1 )
+#define MPP7_PTP_TRIG_GEN MPP( 7, 0x3, 0, 1, 1, 1, 1, 1 )
+
+#define MPP8_GPIO MPP( 8, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP8_TW_SDA MPP( 8, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP8_UART0_RTS MPP( 8, 0x2, 0, 1, 1, 1, 1, 1 )
+#define MPP8_UART1_RTS MPP( 8, 0x3, 0, 1, 1, 1, 1, 1 )
+#define MPP8_MII0_RXERR MPP( 8, 0x4, 1, 0, 0, 1, 1, 1 )
+#define MPP8_SATA1_PRESENTn MPP( 8, 0x5, 0, 1, 0, 0, 1, 1 )
+#define MPP8_PTP_CLK MPP( 8, 0xc, 1, 0, 1, 1, 1, 1 )
+#define MPP8_MII0_COL MPP( 8, 0xd, 1, 0, 1, 1, 1, 1 )
+
+#define MPP9_GPIO MPP( 9, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP9_TW_SCK MPP( 9, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP9_UART0_CTS MPP( 9, 0x2, 1, 0, 1, 1, 1, 1 )
+#define MPP9_UART1_CTS MPP( 9, 0x3, 1, 0, 1, 1, 1, 1 )
+#define MPP9_SATA0_PRESENTn MPP( 9, 0x5, 0, 1, 0, 1, 1, 1 )
+#define MPP9_PTP_EVENT_REQ MPP( 9, 0xc, 1, 0, 1, 1, 1, 1 )
+#define MPP9_MII0_CRS MPP( 9, 0xd, 1, 0, 1, 1, 1, 1 )
+
+#define MPP10_GPO MPP( 10, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP10_SPI_SCK MPP( 10, 0x2, 0, 1, 1, 1, 1, 1 )
+#define MPP10_UART0_TXD MPP( 10, 0X3, 0, 1, 1, 1, 1, 1 )
+#define MPP10_SATA1_ACTn MPP( 10, 0x5, 0, 1, 0, 0, 1, 1 )
+#define MPP10_PTP_TRIG_GEN MPP( 10, 0xc, 0, 1, 1, 1, 1, 1 )
+
+#define MPP11_GPIO MPP( 11, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP11_SPI_MISO MPP( 11, 0x2, 1, 0, 1, 1, 1, 1 )
+#define MPP11_UART0_RXD MPP( 11, 0x3, 1, 0, 1, 1, 1, 1 )
+#define MPP11_PTP_EVENT_REQ MPP( 11, 0x4, 1, 0, 1, 1, 1, 1 )
+#define MPP11_PTP_TRIG_GEN MPP( 11, 0xc, 0, 1, 1, 1, 1, 1 )
+#define MPP11_PTP_CLK MPP( 11, 0xd, 1, 0, 1, 1, 1, 1 )
+#define MPP11_SATA0_ACTn MPP( 11, 0x5, 0, 1, 0, 1, 1, 1 )
+
+#define MPP12_GPO MPP( 12, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP12_SD_CLK MPP( 12, 0x1, 0, 1, 1, 1, 1, 1 )
+
+#define MPP13_GPIO MPP( 13, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP13_SD_CMD MPP( 13, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP13_UART1_TXD MPP( 13, 0x3, 0, 1, 1, 1, 1, 1 )
+
+#define MPP14_GPIO MPP( 14, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP14_SD_D0 MPP( 14, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP14_UART1_RXD MPP( 14, 0x3, 1, 0, 1, 1, 1, 1 )
+#define MPP14_SATA1_PRESENTn MPP( 14, 0x4, 0, 1, 0, 0, 1, 1 )
+#define MPP14_MII0_COL MPP( 14, 0xd, 1, 0, 1, 1, 1, 1 )
+
+#define MPP15_GPIO MPP( 15, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP15_SD_D1 MPP( 15, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP15_UART0_RTS MPP( 15, 0x2, 0, 1, 1, 1, 1, 1 )
+#define MPP15_UART1_TXD MPP( 15, 0x3, 0, 1, 1, 1, 1, 1 )
+#define MPP15_SATA0_ACTn MPP( 15, 0x4, 0, 1, 0, 1, 1, 1 )
+
+#define MPP16_GPIO MPP( 16, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP16_SD_D2 MPP( 16, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP16_UART0_CTS MPP( 16, 0x2, 1, 0, 1, 1, 1, 1 )
+#define MPP16_UART1_RXD MPP( 16, 0x3, 1, 0, 1, 1, 1, 1 )
+#define MPP16_SATA1_ACTn MPP( 16, 0x4, 0, 1, 0, 0, 1, 1 )
+#define MPP16_MII0_CRS MPP( 16, 0xd, 1, 0, 1, 1, 1, 1 )
+
+#define MPP17_GPIO MPP( 17, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP17_SD_D3 MPP( 17, 0x1, 1, 1, 1, 1, 1, 1 )
+#define MPP17_SATA0_PRESENTn MPP( 17, 0x4, 0, 1, 0, 1, 1, 1 )
+
+#define MPP18_GPO MPP( 18, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP18_NF_IO0 MPP( 18, 0x1, 1, 1, 1, 1, 1, 1 )
+
+#define MPP19_GPO MPP( 19, 0x0, 0, 1, 1, 1, 1, 1 )
+#define MPP19_NF_IO1 MPP( 19, 0x1, 1, 1, 1, 1, 1, 1 )
+
+#define MPP20_GPIO MPP( 20, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP20_TSMP0 MPP( 20, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP20_TDM_CH0_TX_QL MPP( 20, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP20_GE1_0 MPP( 20, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP20_AUDIO_SPDIFI MPP( 20, 0x4, 1, 0, 0, 0, 1, 1 )
+#define MPP20_SATA1_ACTn MPP( 20, 0x5, 0, 1, 0, 0, 1, 1 )
+
+#define MPP21_GPIO MPP( 21, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP21_TSMP1 MPP( 21, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP21_TDM_CH0_RX_QL MPP( 21, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP21_GE1_1 MPP( 21, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP21_AUDIO_SPDIFO MPP( 21, 0x4, 0, 1, 0, 0, 1, 1 )
+#define MPP21_SATA0_ACTn MPP( 21, 0x5, 0, 1, 0, 1, 1, 1 )
+
+#define MPP22_GPIO MPP( 22, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP22_TSMP2 MPP( 22, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP22_TDM_CH2_TX_QL MPP( 22, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP22_GE1_2 MPP( 22, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP22_AUDIO_SPDIFRMKCLK MPP( 22, 0x4, 0, 1, 0, 0, 1, 1 )
+#define MPP22_SATA1_PRESENTn MPP( 22, 0x5, 0, 1, 0, 0, 1, 1 )
+
+#define MPP23_GPIO MPP( 23, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP23_TSMP3 MPP( 23, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP23_TDM_CH2_RX_QL MPP( 23, 0x2, 1, 0, 0, 0, 1, 1 )
+#define MPP23_GE1_3 MPP( 23, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP23_AUDIO_I2SBCLK MPP( 23, 0x4, 0, 1, 0, 0, 1, 1 )
+#define MPP23_SATA0_PRESENTn MPP( 23, 0x5, 0, 1, 0, 1, 1, 1 )
+
+#define MPP24_GPIO MPP( 24, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP24_TSMP4 MPP( 24, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP24_TDM_SPI_CS0 DEV( 24, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP24_GE1_4 MPP( 24, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP24_AUDIO_I2SDO MPP( 24, 0x4, 0, 1, 0, 0, 1, 1 )
+
+#define MPP25_GPIO MPP( 25, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP25_TSMP5 MPP( 25, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP25_TDM_SPI_SCK MPP( 25, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP25_GE1_5 MPP( 25, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP25_AUDIO_I2SLRCLK MPP( 25, 0x4, 0, 1, 0, 0, 1, 1 )
+
+#define MPP26_GPIO MPP( 26, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP26_TSMP6 MPP( 26, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP26_TDM_SPI_MISO MPP( 26, 0x2, 1, 0, 0, 0, 1, 1 )
+#define MPP26_GE1_6 MPP( 26, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP26_AUDIO_I2SMCLK MPP( 26, 0x4, 0, 1, 0, 0, 1, 1 )
+
+#define MPP27_GPIO MPP( 27, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP27_TSMP7 MPP( 27, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP27_TDM_SPI_MOSI MPP( 27, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP27_GE1_7 MPP( 27, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP27_AUDIO_I2SDI MPP( 27, 0x4, 1, 0, 0, 0, 1, 1 )
+
+#define MPP28_GPIO MPP( 28, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP28_TSMP8 MPP( 28, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP28_TDM_CODEC_INTn MPP( 28, 0x2, 0, 0, 0, 0, 1, 1 )
+#define MPP28_GE1_8 MPP( 28, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP28_AUDIO_EXTCLK MPP( 28, 0x4, 1, 0, 0, 0, 1, 1 )
+
+#define MPP29_GPIO MPP( 29, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP29_TSMP9 MPP( 29, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP29_TDM_CODEC_RSTn MPP( 29, 0x2, 0, 0, 0, 0, 1, 1 )
+#define MPP29_GE1_9 MPP( 29, 0x3, 0, 0, 0, 1, 1, 1 )
+
+#define MPP30_GPIO MPP( 30, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP30_TSMP10 MPP( 30, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP30_TDM_PCLK MPP( 30, 0x2, 1, 1, 0, 0, 1, 1 )
+#define MPP30_GE1_10 MPP( 30, 0x3, 0, 0, 0, 1, 1, 1 )
+
+#define MPP31_GPIO MPP( 31, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP31_TSMP11 MPP( 31, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP31_TDM_FS MPP( 31, 0x2, 1, 1, 0, 0, 1, 1 )
+#define MPP31_GE1_11 MPP( 31, 0x3, 0, 0, 0, 1, 1, 1 )
+
+#define MPP32_GPIO MPP( 32, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP32_TSMP12 MPP( 32, 0x1, 1, 1, 0, 0, 1, 1 )
+#define MPP32_TDM_DRX MPP( 32, 0x2, 1, 0, 0, 0, 1, 1 )
+#define MPP32_GE1_12 MPP( 32, 0x3, 0, 0, 0, 1, 1, 1 )
+
+#define MPP33_GPIO MPP( 33, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP33_GE1_13 MPP( 33, 0x3, 0, 0, 0, 1, 1, 1 )
+
+#define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1 )
+#define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP34_GE1_14 MPP( 34, 0x3, 0, 0, 0, 1, 1, 1 )
+
+#define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1 )
+#define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1 )
+#define MPP35_GE1_15 MPP( 35, 0x3, 0, 0, 0, 1, 1, 1 )
+#define MPP35_SATA0_ACTn MPP( 35, 0x5, 0, 1, 0, 1, 1, 1 )
+#define MPP35_MII0_RXERR MPP( 35, 0xc, 1, 0, 1, 1, 1, 1 )
+
+#define MPP36_GPIO MPP( 36, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP36_TSMP0 MPP( 36, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP36_TDM_SPI_CS1 MPP( 36, 0x2, 0, 1, 0, 0, 0, 1 )
+#define MPP36_AUDIO_SPDIFI MPP( 36, 0x4, 1, 0, 1, 0, 0, 1 )
+
+#define MPP37_GPIO MPP( 37, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP37_TSMP1 MPP( 37, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP37_TDM_CH2_TX_QL MPP( 37, 0x2, 0, 1, 0, 0, 0, 1 )
+#define MPP37_AUDIO_SPDIFO MPP( 37, 0x4, 0, 1, 1, 0, 0, 1 )
+
+#define MPP38_GPIO MPP( 38, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP38_TSMP2 MPP( 38, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP38_TDM_CH2_RX_QL MPP( 38, 0x2, 0, 1, 0, 0, 0, 1 )
+#define MPP38_AUDIO_SPDIFRMLCLK MPP( 38, 0x4, 0, 1, 1, 0, 0, 1 )
+
+#define MPP39_GPIO MPP( 39, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP39_TSMP3 MPP( 39, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP39_TDM_SPI_CS0 MPP( 39, 0x2, 0, 1, 0, 0, 0, 1 )
+#define MPP39_AUDIO_I2SBCLK MPP( 39, 0x4, 0, 1, 1, 0, 0, 1 )
+
+#define MPP40_GPIO MPP( 40, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP40_TSMP4 MPP( 40, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP40_TDM_SPI_SCK MPP( 40, 0x2, 0, 1, 0, 0, 0, 1 )
+#define MPP40_AUDIO_I2SDO MPP( 40, 0x4, 0, 1, 1, 0, 0, 1 )
+
+#define MPP41_GPIO MPP( 41, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP41_TSMP5 MPP( 41, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP41_TDM_SPI_MISO MPP( 41, 0x2, 1, 0, 0, 0, 0, 1 )
+#define MPP41_AUDIO_I2SLRC MPP( 41, 0x4, 0, 1, 1, 0, 0, 1 )
+
+#define MPP42_GPIO MPP( 42, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP42_TSMP6 MPP( 42, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP42_TDM_SPI_MOSI MPP( 42, 0x2, 0, 1, 0, 0, 0, 1 )
+#define MPP42_AUDIO_I2SMCLK MPP( 42, 0x4, 0, 1, 1, 0, 0, 1 )
+
+#define MPP43_GPIO MPP( 43, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP43_TSMP7 MPP( 43, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP43_TDM_CODEC_INTn MPP( 43, 0x2, 0, 0, 0, 0, 0, 1 )
+#define MPP43_AUDIO_I2SDI MPP( 43, 0x4, 1, 0, 1, 0, 0, 1 )
+
+#define MPP44_GPIO MPP( 44, 0x0, 1, 1, 1, 0, 0, 1 )
+#define MPP44_TSMP8 MPP( 44, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP44_TDM_CODEC_RSTn MPP( 44, 0x2, 0, 0, 0, 0, 0, 1 )
+#define MPP44_AUDIO_EXTCLK MPP( 44, 0x4, 1, 0, 1, 0, 0, 1 )
+
+#define MPP45_GPIO MPP( 45, 0x0, 1, 1, 0, 0, 0, 1 )
+#define MPP45_TSMP9 MPP( 45, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP45_TDM_PCLK MPP( 45, 0x2, 1, 1, 0, 0, 0, 1 )
+
+#define MPP46_GPIO MPP( 46, 0x0, 1, 1, 0, 0, 0, 1 )
+#define MPP46_TSMP10 MPP( 46, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP46_TDM_FS MPP( 46, 0x2, 1, 1, 0, 0, 0, 1 )
+
+#define MPP47_GPIO MPP( 47, 0x0, 1, 1, 0, 0, 0, 1 )
+#define MPP47_TSMP11 MPP( 47, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP47_TDM_DRX MPP( 47, 0x2, 1, 0, 0, 0, 0, 1 )
+
+#define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1 )
+#define MPP48_TSMP12 MPP( 48, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP48_TDM_DTX MPP( 48. 0x2, 0, 1, 0, 0, 0, 1 )
+
+#define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1 )
+#define MPP49_TSMP9 MPP( 49, 0x1, 1, 1, 0, 0, 0, 1 )
+#define MPP49_TDM_CH0_RX_QL MPP( 49, 0x2, 0, 1, 0, 0, 0, 1 )
+#define MPP49_PTP_CLK MPP( 49, 0x5, 1, 0, 0, 0, 0, 1 )
+
+#define MPP_MAX 49
+
+void kirkwood_mpp_conf(unsigned int *mpp_list);
+
+#endif
diff --git a/include/asm-arm/arch-kirkwood/spi.h b/include/asm-arm/arch-kirkwood/spi.h
new file mode 100644
index 0000000..8719279
--- /dev/null
+++ b/include/asm-arm/arch-kirkwood/spi.h
@@ -0,0 +1,56 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)marvell.com>
+ *
+ * Derived from drivers/spi/mpc8xxx_spi.c
+ *
+ * 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
+ */
+
+#ifndef __KW_SPI_H__
+#define __KW_SPI_H__
+
+/* SPI Registers on kirkwood SOC */
+struct kwspi_registers {
+ u32 ctrl; /* 0x10600 */
+ u32 cfg; /* 0x10604 */
+ u32 dout; /* 0x10608 */
+ u32 din; /* 0x1060c */
+ u32 irq_cause; /* 0x10610 */
+ u32 irq_mask; /* 0x10614 */
+};
+
+#define KWSPI_CLKPRESCL_MASK 0x1f
+#define KWSPI_CSN_ACT 1 /* Activates serial memory interface */
+#define KWSPI_SMEMRDY (1 << 1) /* SerMem Data xfer ready */
+#define KWSPI_IRQUNMASK 1 /* unmask SPI interrupt */
+#define KWSPI_IRQMASK 0 /* mask SPI interrupt */
+#define KWSPI_SMEMRDIRQ 1 /* SerMem data xfer ready irq */
+#define KWSPI_XFERLEN_1BYTE 0
+#define KWSPI_XFERLEN_2BYTE (1 << 5)
+#define KWSPI_XFERLEN_MASK (1 << 5)
+#define KWSPI_ADRLEN_1BYTE 0
+#define KWSPI_ADRLEN_2BYTE 1 << 8
+#define KWSPI_ADRLEN_3BYTE 2 << 8
+#define KWSPI_ADRLEN_4BYTE 3 << 8
+#define KWSPI_ADRLEN_MASK 3 << 8
+#define KWSPI_TIMEOUT 10000
+
+#endif /* __KW_SPI_H__ */
diff --git a/include/asm-arm/cache.h b/include/asm-arm/cache.h
new file mode 100644
index 0000000..205b5da
--- /dev/null
+++ b/include/asm-arm/cache.h
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Prafulla Wadaskar <prafulla(a)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
+ */
+
+#ifndef _ASM_CACHE_H
+#define _ASM_CACHE_H
+
+#include <asm/system.h>
+
+/*
+ * Invalidate L2 Cache using co-proc instruction
+ */
+static inline void invalidate_l2_cache(void)
+{
+ unsigned int val=0;
+
+ asm volatile("mcr p15, 1, %0, c15, c11, 0 @ invl l2 cache"
+ : : "r" (val) : "cc");
+ isb();
+}
+#endif /* _ASM_CACHE_H */
diff --git a/include/common.h b/include/common.h
index 30fff7d..9e4b859 100644
--- a/include/common.h
+++ b/include/common.h
@@ -294,6 +294,7 @@ void pciinfo (int, int);
#endif
#endif
+int arch_misc_init (void);
int misc_init_f (void);
int misc_init_r (void);
diff --git a/lib_arm/board.c b/lib_arm/board.c
index e081fbc..5c3bfec 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -399,6 +399,10 @@ void start_armboot (void)
console_init_r (); /* fully init console as a device */
+#if defined(CONFIG_ARCH_MISC_INIT)
+ /* miscellaneous arch dependent initialisations */
+ arch_misc_init ();
+#endif
#if defined(CONFIG_MISC_INIT_R)
/* miscellaneous platform dependent initialisations */
misc_init_r ();
--
1.5.3.3
9
82
Hello,
the following patch set
introduced a new common video driver (patch part 1)
and
update current boards (EB+MCF-EV123) to use it (patch part 2).
this driver is also used for upcomming new boards with vcxk hardware.
regard
Jens Scharsig
3
3
Shove a lot of the HOSTCC and related #ifdef checking crap into the new
compiler.h header so that we can keep all other headers nice and clean.
Also introduce custom uswap functions so we don't have to rely on the non
standard implementations that a host may (or may not in the case of OS X)
provide. This allows mkimage to finally build cleanly on an OS X system.
Signed-off-by: Mike Frysinger <vapier(a)gentoo.org>
---
include/compiler.h | 118 +++++++++++++++++++++++++++++++++++++++++++++++++
include/elf.h | 10 +----
include/environment.h | 6 +--
include/image.h | 9 +---
include/libfdt_env.h | 53 ++--------------------
tools/bmp_logo.c | 13 +-----
tools/img2srec.c | 3 +-
tools/mkimage.c | 14 ++----
tools/mkimage.h | 33 --------------
tools/os_support.h | 2 +
tools/ubsha1.c | 13 -----
11 files changed, 136 insertions(+), 138 deletions(-)
create mode 100644 include/compiler.h
diff --git a/include/compiler.h b/include/compiler.h
new file mode 100644
index 0000000..c6be410
--- /dev/null
+++ b/include/compiler.h
@@ -0,0 +1,118 @@
+/*
+ * Keep all the ugly #ifdef for system stuff here
+ */
+
+#ifndef __COMPILER_H__
+#define __COMPILER_H__
+
+#include <stddef.h>
+
+#ifdef USE_HOSTCC
+
+#if defined(__BEOS__) || \
+ defined(__NetBSD__) || \
+ defined(__FreeBSD__) || \
+ defined(__sun__) || \
+ defined(__APPLE__)
+# include <inttypes.h>
+#elif defined(__linux__) || defined(__WIN32__) || defined(__MINGW32__)
+# include <stdint.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+extern int errno;
+
+#if !defined(__WIN32__) && !defined(__MINGW32__)
+# include <sys/mman.h>
+#endif
+
+#ifndef MAP_FAILED
+#define MAP_FAILED (-1)
+#endif
+
+#include <fcntl.h>
+#ifndef O_BINARY /* should be define'd on __WIN32__ */
+#define O_BINARY 0
+#endif
+
+#ifdef __linux__
+# include <endian.h>
+# include <byteswap.h>
+#elif defined(__MACH__)
+# include <machine/endian.h>
+typedef unsigned long ulong;
+typedef unsigned int uint;
+#endif
+
+#else /* !USE_HOSTCC */
+
+#include <linux/string.h>
+#include <linux/types.h>
+#include <asm/byteorder.h>
+
+/* Types for `void *' pointers. */
+#if __WORDSIZE == 64
+typedef unsigned long int uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+
+#endif
+
+#define uswap_16(x) \
+ ((((x) & 0xff00) >> 8) | \
+ (((x) & 0x00ff) << 8))
+#define uswap_32(x) \
+ ((((x) & 0xff000000) >> 24) | \
+ (((x) & 0x00ff0000) >> 8) | \
+ (((x) & 0x0000ff00) << 8) | \
+ (((x) & 0x000000ff) << 24))
+#define _uswap_64(x, sfx) \
+ ((((x) & 0xff00000000000000##sfx) >> 56) | \
+ (((x) & 0x00ff000000000000##sfx) >> 40) | \
+ (((x) & 0x0000ff0000000000##sfx) >> 24) | \
+ (((x) & 0x000000ff00000000##sfx) >> 8) | \
+ (((x) & 0x00000000ff000000##sfx) << 8) | \
+ (((x) & 0x0000000000ff0000##sfx) << 24) | \
+ (((x) & 0x000000000000ff00##sfx) << 40) | \
+ (((x) & 0x00000000000000ff##sfx) << 56))
+#if defined(__GNUC__)
+# define uswap_64(x) _uswap_64(x, ull)
+#else
+# define uswap_64(x) _uswap_64(x, )
+#endif
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define cpu_to_le16(x) (x)
+# define cpu_to_le32(x) (x)
+# define cpu_to_le64(x) (x)
+# define le16_to_cpu(x) (x)
+# define le32_to_cpu(x) (x)
+# define le64_to_cpu(x) (x)
+# define cpu_to_be16(x) uswap_16(x)
+# define cpu_to_be32(x) uswap_32(x)
+# define cpu_to_be64(x) uswap_64(x)
+# define be16_to_cpu(x) uswap_16(x)
+# define be32_to_cpu(x) uswap_32(x)
+# define be64_to_cpu(x) uswap_64(x)
+#else
+# define cpu_to_le16(x) uswap_16(x)
+# define cpu_to_le32(x) uswap_32(x)
+# define cpu_to_le64(x) uswap_64(x)
+# define le16_to_cpu(x) uswap_16(x)
+# define le32_to_cpu(x) uswap_32(x)
+# define le64_to_cpu(x) uswap_64(x)
+# define cpu_to_be16(x) (x)
+# define cpu_to_be32(x) (x)
+# define cpu_to_be64(x) (x)
+# define be16_to_cpu(x) (x)
+# define be32_to_cpu(x) (x)
+# define be64_to_cpu(x) (x)
+#endif
+
+#endif
diff --git a/include/elf.h b/include/elf.h
index f640388..29f276d 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -33,15 +33,7 @@
#ifndef _ELF_H
#define _ELF_H
-#if defined(__BEOS__) || \
- defined(__NetBSD__) || \
- defined(__FreeBSD__) || \
- defined(__sun__) || \
- defined(__APPLE__)
-#include <inttypes.h>
-#elif (defined(__linux__) && defined(USE_HOSTCC)) || defined(__WIN32__)
-#include <stdint.h>
-#endif
+#include "compiler.h"
/*
* This version doesn't work for 64-bit ABIs - Erik.
diff --git a/include/environment.h b/include/environment.h
index 507e832..5bed32f 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -96,11 +96,7 @@
# endif
#endif /* CONFIG_ENV_IS_IN_MG_DISK */
-#ifdef USE_HOSTCC
-# include <stdint.h>
-#else
-# include <linux/types.h>
-#endif
+#include "compiler.h"
#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT
# define ENV_HEADER_SIZE (sizeof(uint32_t) + 1)
diff --git a/include/image.h b/include/image.h
index f183757..0e6e82d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -33,10 +33,9 @@
#ifndef __IMAGE_H__
#define __IMAGE_H__
-#if USE_HOSTCC
-#ifndef __MINGW32__
-#include <endian.h>
-#endif
+#include "compiler.h"
+
+#ifdef USE_HOSTCC
/* new uImage format support enabled on host */
#define CONFIG_FIT 1
@@ -46,9 +45,7 @@
#else
#include <lmb.h>
-#include <linux/string.h>
#include <asm/u-boot.h>
-#include <asm/byteorder.h>
#endif /* USE_HOSTCC */
diff --git a/include/libfdt_env.h b/include/libfdt_env.h
index 1c67015..bf63583 100644
--- a/include/libfdt_env.h
+++ b/include/libfdt_env.h
@@ -21,56 +21,13 @@
#ifndef _LIBFDT_ENV_H
#define _LIBFDT_ENV_H
-#ifdef USE_HOSTCC
-#include <stdint.h>
-#include <string.h>
-#ifdef __MINGW32__
-#include <linux/types.h>
-#include <linux/byteorder/swab.h>
-#else
-#include <endian.h>
-#include <byteswap.h>
-#endif /* __MINGW32__ */
-#else
-#include <linux/string.h>
-#include <linux/types.h>
-#include <asm/byteorder.h>
-#endif /* USE_HOSTCC */
+#include "compiler.h"
-#include <stddef.h>
extern struct fdt_header *working_fdt; /* Pointer to the working fdt */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#ifdef __MINGW32__
-#define fdt32_to_cpu(x) ___swab32(x)
-#define cpu_to_fdt32(x) ___swab32(x)
-#define fdt64_to_cpu(x) ___swab64(x)
-#define cpu_to_fdt64(x) ___swab64(x)
-#else
-#define fdt32_to_cpu(x) bswap_32(x)
-#define cpu_to_fdt32(x) bswap_32(x)
-#define fdt64_to_cpu(x) bswap_64(x)
-#define cpu_to_fdt64(x) bswap_64(x)
-#endif
-#else
-#define fdt32_to_cpu(x) (x)
-#define cpu_to_fdt32(x) (x)
-#define fdt64_to_cpu(x) (x)
-#define cpu_to_fdt64(x) (x)
-#endif
-
-#ifndef USE_HOSTCC
-/*
- * Types for `void *' pointers.
- *
- * Note: libfdt uses this definition from /usr/include/stdint.h.
- * Define it here rather than pulling in all of stdint.h.
- */
-#if __WORDSIZE == 64
-typedef unsigned long int uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#endif /* not USE_HOSTCC */
+#define fdt32_to_cpu(x) be32_to_cpu(x)
+#define cpu_to_fdt32(x) cpu_to_be32(x)
+#define fdt64_to_cpu(x) be64_to_cpu(x)
+#define cpu_to_fdt64(x) cpu_to_be64(x)
#endif /* _LIBFDT_ENV_H */
diff --git a/tools/bmp_logo.c b/tools/bmp_logo.c
index e8dd8c8..47228d2 100644
--- a/tools/bmp_logo.c
+++ b/tools/bmp_logo.c
@@ -1,15 +1,4 @@
-#include <stdio.h>
-#include <stdlib.h>
-
-#if defined(__linux__)
-#include <stdint.h>
-#else
-#ifdef __CYGWIN__
-#include "elf.h"
-#else
-#include <inttypes.h>
-#endif
-#endif
+#include "compiler.h"
typedef struct bitmap_s { /* bitmap description */
uint16_t width;
diff --git a/tools/img2srec.c b/tools/img2srec.c
index b04abbd..f10379f 100644
--- a/tools/img2srec.c
+++ b/tools/img2srec.c
@@ -52,6 +52,7 @@
| INCLUDES
|*************************************************************************/
+#include "os_support.h"
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -61,8 +62,6 @@
#include <unistd.h>
#include <errno.h>
-extern int errno;
-
/*************************************************************************
| DEFINES
|*************************************************************************/
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 967fe9a..02cdb95 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -25,12 +25,6 @@
#include "mkimage.h"
#include <image.h>
-extern int errno;
-
-#ifndef MAP_FAILED
-#define MAP_FAILED (void *)(-1)
-#endif
-
extern unsigned long crc32 (unsigned long crc, const char *buf, unsigned int len);
static void copy_file (int, const char *, int);
static void usage (void);
@@ -502,7 +496,7 @@ image_verify_header (char *ptr, int image_size)
*/
memcpy (hdr, ptr, sizeof(image_header_t));
- if (ntohl(hdr->ih_magic) != IH_MAGIC) {
+ if (be32_to_cpu(hdr->ih_magic) != IH_MAGIC) {
fprintf (stderr,
"%s: Bad Magic Number: \"%s\" is no valid image\n",
cmdname, imagefile);
@@ -512,8 +506,8 @@ image_verify_header (char *ptr, int image_size)
data = (char *)hdr;
len = sizeof(image_header_t);
- checksum = ntohl(hdr->ih_hcrc);
- hdr->ih_hcrc = htonl(0); /* clear for re-calculation */
+ checksum = be32_to_cpu(hdr->ih_hcrc);
+ hdr->ih_hcrc = cpu_to_be32(0); /* clear for re-calculation */
if (crc32 (0, data, len) != checksum) {
fprintf (stderr,
@@ -525,7 +519,7 @@ image_verify_header (char *ptr, int image_size)
data = ptr + sizeof(image_header_t);
len = image_size - sizeof(image_header_t) ;
- if (crc32 (0, data, len) != ntohl(hdr->ih_dcrc)) {
+ if (crc32 (0, data, len) != be32_to_cpu(hdr->ih_dcrc)) {
fprintf (stderr,
"%s: ERROR: \"%s\" has corrupted data!\n",
cmdname, imagefile);
diff --git a/tools/mkimage.h b/tools/mkimage.h
index c8df6e1..70c53ad 100644
--- a/tools/mkimage.h
+++ b/tools/mkimage.h
@@ -26,14 +26,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifndef __WIN32__
-#include <netinet/in.h> /* for host / network byte order conversions */
-#endif
-#ifdef __MINGW32__
-#include <stdint.h>
-#else
-#include <sys/mman.h>
-#endif
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
@@ -53,28 +45,3 @@
#define MKIMAGE_DEFAULT_DTC_OPTIONS "-I dts -O dtb -p 500"
#define MKIMAGE_MAX_DTC_CMDLINE_LEN 512
#define MKIMAGE_DTC "dtc" /* assume dtc is in $PATH */
-
-#if defined(__BEOS__) || defined(__NetBSD__) || defined(__APPLE__)
-#include <inttypes.h>
-#endif
-
-#ifdef __WIN32__
-typedef unsigned int __u32;
-
-#define SWAP_LONG(x) \
- ((__u32)( \
- (((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
- (((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
- (((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
- (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
-typedef unsigned char uint8_t;
-typedef unsigned short uint16_t;
-typedef unsigned int uint32_t;
-
-#define ntohl(a) SWAP_LONG(a)
-#define htonl(a) SWAP_LONG(a)
-#endif /* __WIN32__ */
-
-#ifndef O_BINARY /* should be define'd on __WIN32__ */
-#define O_BINARY 0
-#endif
diff --git a/tools/os_support.h b/tools/os_support.h
index f6f86b0..7bf930e 100644
--- a/tools/os_support.h
+++ b/tools/os_support.h
@@ -19,6 +19,8 @@
#ifndef __OS_SUPPORT_H_
#define __OS_SUPPORT_H_
+#include "compiler.h"
+
/*
* Include additional files required for supporting different operating systems
*/
diff --git a/tools/ubsha1.c b/tools/ubsha1.c
index c4203ed..9774eea 100644
--- a/tools/ubsha1.c
+++ b/tools/ubsha1.c
@@ -28,9 +28,6 @@
#include <fcntl.h>
#include <errno.h>
#include <string.h>
-#ifndef __MINGW32__
-#include <sys/mman.h>
-#endif
#include <sys/stat.h>
#include "sha1.h"
@@ -40,16 +37,6 @@
#include <config.h>
#undef __ASSEMBLY__
-#ifndef O_BINARY /* should be define'd on __WIN32__ */
-#define O_BINARY 0
-#endif
-
-#ifndef MAP_FAILED
-#define MAP_FAILED (-1)
-#endif
-
-extern int errno;
-
extern void sha1_csum (unsigned char *input, int ilen, unsigned char output[20]);
int main (int argc, char **argv)
--
1.6.3.1
2
5

[U-Boot] [PATCH 1/3 v5] stdio/device: rework function naming convention
by Jean-Christophe PLAGNIOL-VILLARD 19 Jul '09
by Jean-Christophe PLAGNIOL-VILLARD 19 Jul '09
19 Jul '09
actually the console API use the following naming convention
======Extract======
typedef struct device_t;
int device_register (device_t * dev);
int devices_init (void);
int device_deregister(char *devname);
struct list_head* device_get_list(void);
device_t* device_get_by_name(char* name);
device_t* device_clone(device_t *dev);
=======
which is device generic and confusing
instead of using device_XX and device_t
we now switch to stdio_XX and stdio_dev
this will also allow to add later a generic device mecanism
in order to have multi generic device support and driver instance
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj(a)jcrosoft.com>
---
board/MAI/AmigaOneG3SE/ps2kbd.c | 6 +-
board/MAI/AmigaOneG3SE/video.c | 6 +-
board/ads5121/ads5121_diu.c | 2 +-
board/bf527-ezkit/video.c | 6 +-
board/bf533-stamp/video.c | 6 +-
board/bf548-ezkit/video.c | 6 +-
board/bmw/bmw.c | 2 +-
board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c | 2 +-
board/linkstation/avr.c | 2 +-
board/mpl/common/common_util.c | 2 +-
board/mpl/common/isa.c | 2 +-
board/mpl/common/kbd.c | 6 +-
board/mpl/pati/pati.c | 6 +-
board/netphone/phone_console.c | 6 +-
board/rbc823/kbd.c | 8 ++--
board/trab/vfd.c | 2 +-
common/Makefile | 2 +-
common/cmd_console.c | 8 ++--
common/cmd_log.c | 6 +-
common/cmd_terminal.c | 6 +-
common/console.c | 36 +++++++++---------
common/iomux.c | 14 +++---
common/lcd.c | 6 +-
common/serial.c | 8 ++--
common/{devices.c => stdio.c} | 50 ++++++++++++------------
common/usb_kbd.c | 14 +++---
cpu/blackfin/jtag-console.c | 6 +-
cpu/mpc8xx/lcd.c | 2 +-
cpu/mpc8xx/video.c | 6 +-
cpu/pxa/pxafb.c | 2 +-
drivers/input/keyboard.c | 6 +-
drivers/net/netconsole.c | 6 +-
drivers/serial/arm_dcc.c | 6 +-
drivers/serial/usbtty.c | 6 +-
drivers/usb/musb/musb_hcd.c | 4 +-
drivers/usb/musb/musb_hcd.h | 2 +-
drivers/video/cfb_console.c | 6 +-
include/configs/AmigaOneG3SE.h | 2 +-
include/configs/MIP405.h | 2 +-
include/configs/MPC8610HPCD.h | 2 +-
include/configs/MPC8641HPCN.h | 2 +-
include/configs/PIP405.h | 2 +-
include/configs/VCMA9.h | 2 +-
include/configs/gr_ep2s60.h | 2 +-
include/configs/mp2usb.h | 2 +-
include/console.h | 36 ------------------
include/iomux.h | 6 +-
include/serial.h | 2 +-
include/{devices.h => stdio_dev.h} | 32 ++++++++--------
lib_arm/board.c | 4 +-
lib_avr32/board.c | 4 +-
lib_blackfin/board.c | 6 +-
lib_blackfin/post.c | 2 +-
lib_i386/board.c | 4 +-
lib_i386/video.c | 10 ++--
lib_m68k/board.c | 6 +-
lib_mips/board.c | 6 +-
lib_nios/board.c | 4 +-
lib_nios2/board.c | 4 +-
lib_ppc/board.c | 6 +-
lib_sh/board.c | 4 +-
lib_sparc/board.c | 6 +-
post/post.c | 2 +-
63 files changed, 198 insertions(+), 234 deletions(-)
rename common/{devices.c => stdio.c} (84%)
delete mode 100644 include/console.h
rename include/{devices.h => stdio_dev.h} (85%)
diff --git a/board/MAI/AmigaOneG3SE/ps2kbd.c b/board/MAI/AmigaOneG3SE/ps2kbd.c
index a297005..aa164b0 100644
--- a/board/MAI/AmigaOneG3SE/ps2kbd.c
+++ b/board/MAI/AmigaOneG3SE/ps2kbd.c
@@ -34,7 +34,7 @@
*/
#include <common.h>
#include <asm/processor.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include "ps2kbd.h"
@@ -226,7 +226,7 @@ int overwrite_console (void)
int drv_isa_kbd_init (void)
{
int error;
- device_t kbddev ;
+ struct stdio_dev kbddev ;
char *stdinname = getenv ("stdin");
if(isa_kbd_init() == -1)
@@ -239,7 +239,7 @@ int drv_isa_kbd_init (void)
kbddev.getc = kbd_getc ;
kbddev.tstc = kbd_testc ;
- error = device_register (&kbddev);
+ error = stdio_register (&kbddev);
if(error==0) {
/* check if this is the standard input device */
if(strcmp(stdinname,DEVNAME)==0) {
diff --git a/board/MAI/AmigaOneG3SE/video.c b/board/MAI/AmigaOneG3SE/video.c
index fc27c68..e24e28b 100644
--- a/board/MAI/AmigaOneG3SE/video.c
+++ b/board/MAI/AmigaOneG3SE/video.c
@@ -22,7 +22,7 @@
*/
#include <common.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include "memio.h"
#include <part.h>
@@ -98,7 +98,7 @@ int video_inited = 0;
int drv_video_init(void)
{
int error, devices = 1 ;
- device_t vgadev ;
+ struct stdio_dev vgadev ;
if (video_inited) return 1;
video_inited = 1;
video_init();
@@ -112,7 +112,7 @@ int drv_video_init(void)
vgadev.tstc = NULL;
vgadev.start = video_start;
- error = device_register (&vgadev);
+ error = stdio_register (&vgadev);
if (error == 0)
{
diff --git a/board/ads5121/ads5121_diu.c b/board/ads5121/ads5121_diu.c
index 41a1353..ee7ed52 100644
--- a/board/ads5121/ads5121_diu.c
+++ b/board/ads5121/ads5121_diu.c
@@ -33,7 +33,7 @@
#include "../freescale/common/fsl_diu_fb.h"
#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <devices.h>
+#include <stdio_dev.h>
#include <video_fb.h>
#endif
diff --git a/board/bf527-ezkit/video.c b/board/bf527-ezkit/video.c
index 2df6717..0b6b7b2 100644
--- a/board/bf527-ezkit/video.c
+++ b/board/bf527-ezkit/video.c
@@ -14,7 +14,7 @@
#include <asm/mach-common/bits/dma.h>
#include <i2c.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
int gunzip(void *, int, unsigned char *, unsigned long *);
@@ -272,7 +272,7 @@ void video_puts(const char *s)
int drv_video_init(void)
{
int error, devices = 1;
- device_t videodev;
+ struct stdio_dev videodev;
u8 *dst;
u32 fbmem_size = LCD_X_RES * LCD_Y_RES * LCD_PIXEL_SIZE + ACTIVE_VIDEO_MEM_OFFSET;
@@ -311,7 +311,7 @@ int drv_video_init(void)
videodev.putc = video_putc; /* 'putc' function */
videodev.puts = video_puts; /* 'puts' function */
- error = device_register(&videodev);
+ error = stdio_register(&videodev);
return (error == 0) ? devices : error;
}
diff --git a/board/bf533-stamp/video.c b/board/bf533-stamp/video.c
index 3c15eaa..28ffa61 100644
--- a/board/bf533-stamp/video.c
+++ b/board/bf533-stamp/video.c
@@ -18,7 +18,7 @@
#include <asm/mach-common/bits/dma.h>
#include <i2c.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
int gunzip(void *, int, unsigned char *, unsigned long *);
@@ -154,7 +154,7 @@ static void video_init(char *NTSCFrame)
int drv_video_init(void)
{
- device_t videodev;
+ struct stdio_dev videodev;
video_init((void *)NTSC_FRAME_ADDR);
@@ -163,5 +163,5 @@ int drv_video_init(void)
videodev.ext = DEV_EXT_VIDEO;
videodev.flags = DEV_FLAGS_SYSTEM;
- return device_register(&videodev);
+ return stdio_register(&videodev);
}
diff --git a/board/bf548-ezkit/video.c b/board/bf548-ezkit/video.c
index a6f52bd..f4f1bec 100644
--- a/board/bf548-ezkit/video.c
+++ b/board/bf548-ezkit/video.c
@@ -14,7 +14,7 @@
#include <asm/mach-common/bits/dma.h>
#include <i2c.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
int gunzip(void *, int, unsigned char *, unsigned long *);
@@ -282,7 +282,7 @@ void video_puts(const char *s)
int drv_video_init(void)
{
int error, devices = 1;
- device_t videodev;
+ struct stdio_dev videodev;
u8 *dst;
u32 fbmem_size = LCD_X_RES * LCD_Y_RES * LCD_PIXEL_SIZE + ACTIVE_VIDEO_MEM_OFFSET;
@@ -321,7 +321,7 @@ int drv_video_init(void)
videodev.putc = video_putc; /* 'putc' function */
videodev.puts = video_puts; /* 'puts' function */
- error = device_register(&videodev);
+ error = stdio_register(&videodev);
return (error == 0) ? devices : error;
}
diff --git a/board/bmw/bmw.c b/board/bmw/bmw.c
index 41ce14f..870011e 100644
--- a/board/bmw/bmw.c
+++ b/board/bmw/bmw.c
@@ -26,7 +26,7 @@
#include <watchdog.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <net.h>
#include <timestamp.h>
#include <dtt.h>
diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
index 2b2d5d7..68b9e8d 100644
--- a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
+++ b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
@@ -33,7 +33,7 @@
#include "../common/fsl_diu_fb.h"
#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE)
-#include <devices.h>
+#include <stdio_dev.h>
#include <video_fb.h>
#endif
diff --git a/board/linkstation/avr.c b/board/linkstation/avr.c
index 782b24a..ec6d400 100644
--- a/board/linkstation/avr.c
+++ b/board/linkstation/avr.c
@@ -22,7 +22,7 @@
*/
#include <common.h>
#include <ns16550.h>
-#include <console.h>
+#include <stdio_dev.h>
/* Button codes from the AVR */
#define PWRR 0x20 /* Power button release */
diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index d169391..243e3eb 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -29,7 +29,7 @@
#include <asm/processor.h>
#include <asm/byteorder.h>
#include <i2c.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <pci.h>
#include <malloc.h>
#include <bzlib.h>
diff --git a/board/mpl/common/isa.c b/board/mpl/common/isa.c
index 91829d4..5d467b4 100644
--- a/board/mpl/common/isa.c
+++ b/board/mpl/common/isa.c
@@ -26,7 +26,7 @@
#include <common.h>
#include <asm/processor.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include "isa.h"
#include "piix4_pci.h"
#include "kbd.h"
diff --git a/board/mpl/common/kbd.c b/board/mpl/common/kbd.c
index a457635..b0a9620 100644
--- a/board/mpl/common/kbd.c
+++ b/board/mpl/common/kbd.c
@@ -28,7 +28,7 @@
*/
#include <common.h>
#include <asm/processor.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include "isa.h"
#include "kbd.h"
@@ -215,7 +215,7 @@ int overwrite_console (void)
int drv_isa_kbd_init (void)
{
int error;
- device_t kbddev ;
+ struct stdio_dev kbddev ;
char *stdinname = getenv ("stdin");
if(isa_kbd_init()==-1)
@@ -228,7 +228,7 @@ int drv_isa_kbd_init (void)
kbddev.getc = kbd_getc ;
kbddev.tstc = kbd_testc ;
- error = device_register (&kbddev);
+ error = stdio_register (&kbddev);
if(error==0) {
/* check if this is the standard input device */
if(strcmp(stdinname,DEVNAME)==0) {
diff --git a/board/mpl/pati/pati.c b/board/mpl/pati/pati.c
index 85c5af9..8f23d2d 100644
--- a/board/mpl/pati/pati.c
+++ b/board/mpl/pati/pati.c
@@ -46,7 +46,7 @@
#include <common.h>
#include <mpc5xx.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <pci_ids.h>
#define PLX9056_LOC
#include "plx9056.h"
@@ -447,7 +447,7 @@ int checkboard (void)
int recbuf[REC_BUFFER_SIZE];
static int r_ptr = 0;
int w_ptr;
-device_t pci_con_dev;
+struct stdio_dev pci_con_dev;
int conn=0;
int buff_full=0;
@@ -584,7 +584,7 @@ void pci_con_connect(void)
pci_con_dev.puts = pci_con_puts;
pci_con_dev.getc = pci_con_getc;
pci_con_dev.tstc = pci_con_tstc;
- device_register (&pci_con_dev);
+ stdio_register (&pci_con_dev);
printf("PATI ready for PCI connection, type ctrl-c for exit\n");
do {
udelay(10);
diff --git a/board/netphone/phone_console.c b/board/netphone/phone_console.c
index d9b0ad3..3d82e04 100644
--- a/board/netphone/phone_console.c
+++ b/board/netphone/phone_console.c
@@ -37,7 +37,7 @@
#include <version.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <sed156x.h>
@@ -325,7 +325,7 @@ int phone_getc(void)
int drv_phone_init(void)
{
- device_t console_dev;
+ struct stdio_dev console_dev;
console_init();
@@ -340,7 +340,7 @@ int drv_phone_init(void)
console_dev.tstc = phone_tstc; /* 'tstc' function */
console_dev.getc = phone_getc; /* 'getc' function */
- if (device_register(&console_dev) == 0)
+ if (stdio_register(&console_dev) == 0)
return 1;
return 0;
diff --git a/board/rbc823/kbd.c b/board/rbc823/kbd.c
index 1d48f6d..853cbde 100644
--- a/board/rbc823/kbd.c
+++ b/board/rbc823/kbd.c
@@ -30,7 +30,7 @@
#include <common.h>
#include <watchdog.h>
#include <commproc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <lcd.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -249,18 +249,18 @@ int smc1_tstc(void)
int drv_keyboard_init(void)
{
int error = 0;
- device_t kbd_dev;
+ struct stdio_dev kbd_dev;
if (0) {
/* register the keyboard */
- memset (&kbd_dev, 0, sizeof(device_t));
+ memset (&kbd_dev, 0, sizeof(struct stdio_dev));
strcpy(kbd_dev.name, "kbd");
kbd_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
kbd_dev.putc = NULL;
kbd_dev.puts = NULL;
kbd_dev.getc = smc1_getc;
kbd_dev.tstc = smc1_tstc;
- error = device_register (&kbd_dev);
+ error = stdio_register (&kbd_dev);
} else {
lcd_is_enabled = 0;
lcd_disable();
diff --git a/board/trab/vfd.c b/board/trab/vfd.c
index 37d3aa4..e5ca4ab 100644
--- a/board/trab/vfd.c
+++ b/board/trab/vfd.c
@@ -36,7 +36,7 @@
#include <version.h>
#include <stdarg.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <s3c2400.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/common/Makefile b/common/Makefile
index b9f4ca7..f47e2ed 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -32,7 +32,6 @@ COBJS-y += main.o
COBJS-y += circbuf.o
COBJS-y += console.o
COBJS-y += command.o
-COBJS-y += devices.o
COBJS-y += dlmalloc.o
COBJS-y += exports.o
COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o
@@ -40,6 +39,7 @@ COBJS-y += image.o
COBJS-y += memsize.o
COBJS-y += s_record.o
COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
+COBJS-y += stdio.o
COBJS-y += xyzModem.o
# core command
diff --git a/common/cmd_console.c b/common/cmd_console.c
index f861f83..178fbfe 100644
--- a/common/cmd_console.c
+++ b/common/cmd_console.c
@@ -26,22 +26,22 @@
*/
#include <common.h>
#include <command.h>
-#include <devices.h>
+#include <stdio_dev.h>
extern void _do_coninfo (void);
int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char *argv[])
{
int l;
- struct list_head *list = device_get_list();
+ struct list_head *list = stdio_get_list();
struct list_head *pos;
- device_t *dev;
+ struct stdio_dev *dev;
/* Scan for valid output and input devices */
puts ("List of available devices:\n");
list_for_each(pos, list) {
- dev = list_entry(pos, device_t, list);
+ dev = list_entry(pos, struct stdio_dev, list);
printf ("%-8s %08x %c%c%c ",
dev->name,
diff --git a/common/cmd_log.c b/common/cmd_log.c
index a03835d..4b7a747 100644
--- a/common/cmd_log.c
+++ b/common/cmd_log.c
@@ -42,7 +42,7 @@
#include <common.h>
#include <command.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <post.h>
#include <logbuff.h>
@@ -142,7 +142,7 @@ void logbuff_reset (void)
int drv_logbuff_init (void)
{
- device_t logdev;
+ struct stdio_dev logdev;
int rc;
/* Device initialization */
@@ -154,7 +154,7 @@ int drv_logbuff_init (void)
logdev.putc = logbuff_putc; /* 'putc' function */
logdev.puts = logbuff_puts; /* 'puts' function */
- rc = device_register (&logdev);
+ rc = stdio_register (&logdev);
return (rc == 0) ? 1 : rc;
}
diff --git a/common/cmd_terminal.c b/common/cmd_terminal.c
index fd3dd48..60ec378 100644
--- a/common/cmd_terminal.c
+++ b/common/cmd_terminal.c
@@ -26,19 +26,19 @@
*/
#include <common.h>
#include <command.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <serial.h>
int do_terminal(cmd_tbl_t * cmd, int flag, int argc, char *argv[])
{
int last_tilde = 0;
- device_t *dev = NULL;
+ struct stdio_dev *dev = NULL;
if (argc < 1)
return -1;
/* Scan for selected output/input device */
- dev = device_get_by_name(argv[1]);
+ dev = stdio_get_by_name(argv[1]);
if (!dev)
return -1;
diff --git a/common/console.c b/common/console.c
index 2add047..0a36d2f 100644
--- a/common/console.c
+++ b/common/console.c
@@ -24,7 +24,7 @@
#include <common.h>
#include <stdarg.h>
#include <malloc.h>
-#include <console.h>
+#include <stdio_dev.h>
#include <exports.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -48,7 +48,7 @@ extern int overwrite_console(void);
#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
-static int console_setfile(int file, device_t * dev)
+static int console_setfile(int file, struct stdio_dev * dev)
{
int error = 0;
@@ -96,8 +96,8 @@ static int console_setfile(int file, device_t * dev)
#if defined(CONFIG_CONSOLE_MUX)
/** Console I/O multiplexing *******************************************/
-static device_t *tstcdev;
-device_t **console_devices[MAX_FILES];
+static struct stdio_dev *tstcdev;
+struct stdio_dev **console_devices[MAX_FILES];
int cd_count[MAX_FILES];
/*
@@ -119,7 +119,7 @@ static int console_getc(int file)
static int console_tstc(int file)
{
int i, ret;
- device_t *dev;
+ struct stdio_dev *dev;
disable_ctrlc(1);
for (i = 0; i < cd_count[file]; i++) {
@@ -141,7 +141,7 @@ static int console_tstc(int file)
static void console_putc(int file, const char c)
{
int i;
- device_t *dev;
+ struct stdio_dev *dev;
for (i = 0; i < cd_count[file]; i++) {
dev = console_devices[file][i];
@@ -153,7 +153,7 @@ static void console_putc(int file, const char c)
static void console_puts(int file, const char *s)
{
int i;
- device_t *dev;
+ struct stdio_dev *dev;
for (i = 0; i < cd_count[file]; i++) {
dev = console_devices[file][i];
@@ -167,7 +167,7 @@ static inline void console_printdevs(int file)
iomux_printdevs(file);
}
-static inline void console_doenv(int file, device_t *dev)
+static inline void console_doenv(int file, struct stdio_dev *dev)
{
iomux_doenv(file, dev->name);
}
@@ -197,7 +197,7 @@ static inline void console_printdevs(int file)
printf("%s\n", stdio_devices[file]->name);
}
-static inline void console_doenv(int file, device_t *dev)
+static inline void console_doenv(int file, struct stdio_dev *dev)
{
console_setfile(file, dev);
}
@@ -479,11 +479,11 @@ inline void dbg(const char *fmt, ...)
/** U-Boot INIT FUNCTIONS *************************************************/
-device_t *search_device(int flags, char *name)
+struct stdio_dev *search_device(int flags, char *name)
{
- device_t *dev;
+ struct stdio_dev *dev;
- dev = device_get_by_name(name);
+ dev = stdio_get_by_name(name);
if (dev && (dev->flags & flags))
return dev;
@@ -494,7 +494,7 @@ device_t *search_device(int flags, char *name)
int console_assign(int file, char *devname)
{
int flag;
- device_t *dev;
+ struct stdio_dev *dev;
/* Check for valid file */
switch (file) {
@@ -537,7 +537,7 @@ int console_init_f(void)
int console_init_r(void)
{
char *stdinname, *stdoutname, *stderrname;
- device_t *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
+ struct stdio_dev *inputdev = NULL, *outputdev = NULL, *errdev = NULL;
#ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
int i;
#endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
@@ -645,11 +645,11 @@ done:
/* Called after the relocation - use desired console functions */
int console_init_r(void)
{
- device_t *inputdev = NULL, *outputdev = NULL;
+ struct stdio_dev *inputdev = NULL, *outputdev = NULL;
int i;
- struct list_head *list = device_get_list();
+ struct list_head *list = stdio_get_list();
struct list_head *pos;
- device_t *dev;
+ struct stdio_dev *dev;
#ifdef CONFIG_SPLASH_SCREEN
/*
@@ -662,7 +662,7 @@ int console_init_r(void)
/* Scan devices looking for input and output devices */
list_for_each(pos, list) {
- dev = list_entry(pos, device_t, list);
+ dev = list_entry(pos, struct stdio_dev, list);
if ((dev->flags & DEV_FLAGS_INPUT) && (inputdev == NULL)) {
inputdev = dev;
diff --git a/common/iomux.c b/common/iomux.c
index bdcc853..91d98e9 100644
--- a/common/iomux.c
+++ b/common/iomux.c
@@ -29,7 +29,7 @@
void iomux_printdevs(const int console)
{
int i;
- device_t *dev;
+ struct stdio_dev *dev;
for (i = 0; i < cd_count[console]; i++) {
dev = console_devices[console][i];
@@ -43,8 +43,8 @@ int iomux_doenv(const int console, const char *arg)
{
char *console_args, *temp, **start;
int i, j, k, io_flag, cs_idx, repeat;
- device_t *dev;
- device_t **cons_set;
+ struct stdio_dev *dev;
+ struct stdio_dev **cons_set;
console_args = strdup(arg);
if (console_args == NULL)
@@ -85,7 +85,7 @@ int iomux_doenv(const int console, const char *arg)
*temp = '\0';
start[i] = temp + 1;
}
- cons_set = (device_t **)calloc(i, sizeof(device_t *));
+ cons_set = (struct stdio_dev **)calloc(i, sizeof(struct stdio_dev *));
if (cons_set == NULL) {
free(start);
free(console_args);
@@ -158,14 +158,14 @@ int iomux_doenv(const int console, const char *arg)
} else {
/* Works even if console_devices[console] is NULL. */
console_devices[console] =
- (device_t **)realloc(console_devices[console],
- cs_idx * sizeof(device_t *));
+ (struct stdio_dev **)realloc(console_devices[console],
+ cs_idx * sizeof(struct stdio_dev *));
if (console_devices[console] == NULL) {
free(cons_set);
return 1;
}
memcpy(console_devices[console], cons_set, cs_idx *
- sizeof(device_t *));
+ sizeof(struct stdio_dev *));
cd_count[console] = cs_idx;
}
diff --git a/common/lcd.c b/common/lcd.c
index 4155170..60937bf 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -34,7 +34,7 @@
#include <command.h>
#include <stdarg.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
#if defined(CONFIG_POST)
#include <post.h>
#endif
@@ -355,7 +355,7 @@ static void test_pattern (void)
int drv_lcd_init (void)
{
- device_t lcddev;
+ struct stdio_dev lcddev;
int rc;
lcd_base = (void *)(gd->fb_base);
@@ -373,7 +373,7 @@ int drv_lcd_init (void)
lcddev.putc = lcd_putc; /* 'putc' function */
lcddev.puts = lcd_puts; /* 'puts' function */
- rc = device_register (&lcddev);
+ rc = stdio_register (&lcddev);
return (rc == 0) ? 1 : rc;
}
diff --git a/common/serial.c b/common/serial.c
index 09385d0..11cee56 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -23,7 +23,7 @@
#include <common.h>
#include <serial.h>
-#include <devices.h>
+#include <stdio_dev.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -139,9 +139,9 @@ void serial_initialize (void)
serial_assign (default_serial_console ()->name);
}
-void serial_devices_init (void)
+void serial_stdio_init (void)
{
- device_t dev;
+ struct stdio_dev dev;
struct serial_device *s = serial_devices;
while (s) {
@@ -156,7 +156,7 @@ void serial_devices_init (void)
dev.getc = s->getc;
dev.tstc = s->tstc;
- device_register (&dev);
+ stdio_register (&dev);
s = s->next;
}
diff --git a/common/devices.c b/common/stdio.c
similarity index 84%
rename from common/devices.c
rename to common/stdio.c
index ba53c9b..697df5a 100644
--- a/common/devices.c
+++ b/common/stdio.c
@@ -25,7 +25,7 @@
#include <common.h>
#include <stdarg.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <serial.h>
#ifdef CONFIG_LOGBUFFER
#include <logbuff.h>
@@ -36,8 +36,8 @@
DECLARE_GLOBAL_DATA_PTR;
-static device_t devs;
-device_t *stdio_devices[] = { NULL, NULL, NULL };
+static struct stdio_dev devs;
+struct stdio_dev *stdio_devices[] = { NULL, NULL, NULL };
char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" };
#if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV)
@@ -70,7 +70,7 @@ int nulldev_input(void)
static void drv_system_init (void)
{
- device_t dev;
+ struct stdio_dev dev;
memset (&dev, 0, sizeof (dev));
@@ -88,7 +88,7 @@ static void drv_system_init (void)
dev.tstc = serial_tstc;
#endif
- device_register (&dev);
+ stdio_register (&dev);
#ifdef CONFIG_SYS_DEVICE_NULLDEV
memset (&dev, 0, sizeof (dev));
@@ -100,7 +100,7 @@ static void drv_system_init (void)
dev.getc = nulldev_input;
dev.tstc = nulldev_input;
- device_register (&dev);
+ stdio_register (&dev);
#endif
}
@@ -108,21 +108,21 @@ static void drv_system_init (void)
* DEVICES
**************************************************************************
*/
-struct list_head* device_get_list(void)
+struct list_head* stdio_get_list(void)
{
return &(devs.list);
}
-device_t* device_get_by_name(char* name)
+struct stdio_dev* stdio_get_by_name(char* name)
{
struct list_head *pos;
- device_t *dev;
+ struct stdio_dev *dev;
if(!name)
return NULL;
list_for_each(pos, &(devs.list)) {
- dev = list_entry(pos, device_t, list);
+ dev = list_entry(pos, struct stdio_dev, list);
if(strcmp(dev->name, name) == 0)
return dev;
}
@@ -130,29 +130,29 @@ device_t* device_get_by_name(char* name)
return NULL;
}
-device_t* device_clone(device_t *dev)
+struct stdio_dev* stdio_clone(struct stdio_dev *dev)
{
- device_t *_dev;
+ struct stdio_dev *_dev;
if(!dev)
return NULL;
- _dev = calloc(1, sizeof(device_t));
+ _dev = calloc(1, sizeof(struct stdio_dev));
if(!_dev)
return NULL;
- memcpy(_dev, dev, sizeof(device_t));
+ memcpy(_dev, dev, sizeof(struct stdio_dev));
strncpy(_dev->name, dev->name, 16);
return _dev;
}
-int device_register (device_t * dev)
+int stdio_register (struct stdio_dev * dev)
{
- device_t *_dev;
+ struct stdio_dev *_dev;
- _dev = device_clone(dev);
+ _dev = stdio_clone(dev);
if(!_dev)
return -1;
list_add_tail(&(_dev->list), &(devs.list));
@@ -162,15 +162,15 @@ int device_register (device_t * dev)
/* deregister the device "devname".
* returns 0 if success, -1 if device is assigned and 1 if devname not found
*/
-#ifdef CONFIG_SYS_DEVICE_DEREGISTER
-int device_deregister(char *devname)
+#ifdef CONFIG_SYS_STDIO_DEREGISTER
+int stdio_deregister(char *devname)
{
int l;
struct list_head *pos;
- device_t *dev;
+ struct stdio_dev *dev;
char temp_names[3][8];
- dev = device_get_by_name(devname);
+ dev = stdio_get_by_name(devname);
if(!dev) /* device not found */
return -1;
@@ -189,7 +189,7 @@ int device_deregister(char *devname)
/* reassign Device list */
list_for_each(pos, &(devs.list)) {
- dev = list_entry(pos, device_t, list);
+ dev = list_entry(pos, struct stdio_dev, list);
for (l=0 ; l< MAX_FILES; l++) {
if(strcmp(dev->name, temp_names[l]) == 0)
stdio_devices[l] = dev;
@@ -197,9 +197,9 @@ int device_deregister(char *devname)
}
return 0;
}
-#endif /* CONFIG_SYS_DEVICE_DEREGISTER */
+#endif /* CONFIG_SYS_STDIO_DEREGISTER */
-int devices_init (void)
+int stdio_init (void)
{
#ifndef CONFIG_ARM /* already relocated for current ARM implementation */
ulong relocation_offset = gd->reloc_off;
@@ -235,7 +235,7 @@ int devices_init (void)
#endif
drv_system_init ();
#ifdef CONFIG_SERIAL_MULTI
- serial_devices_init ();
+ serial_stdio_init ();
#endif
#ifdef CONFIG_USB_TTY
drv_usbtty_init ();
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index e0d006c..b458d77 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -25,7 +25,7 @@
*
*/
#include <common.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <asm/byteorder.h>
#include <usb.h>
@@ -153,7 +153,7 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum);
int drv_usb_kbd_init(void)
{
int error,i;
- device_t usb_kbd_dev,*old_dev;
+ struct stdio_dev usb_kbd_dev,*old_dev;
struct usb_device *dev;
char *stdinname = getenv ("stdin");
@@ -168,7 +168,7 @@ int drv_usb_kbd_init(void)
if(usb_kbd_probe(dev,0)==1) { /* Ok, we found a keyboard */
/* check, if it is already registered */
USB_KBD_PRINTF("USB KBD found set up device.\n");
- old_dev = device_get_by_name(DEVNAME);
+ old_dev = stdio_get_by_name(DEVNAME);
if(old_dev) {
/* ok, already registered, just return ok */
USB_KBD_PRINTF("USB KBD is already registered.\n");
@@ -176,7 +176,7 @@ int drv_usb_kbd_init(void)
}
/* register the keyboard */
USB_KBD_PRINTF("USB KBD register.\n");
- memset (&usb_kbd_dev, 0, sizeof(device_t));
+ memset (&usb_kbd_dev, 0, sizeof(struct stdio_dev));
strcpy(usb_kbd_dev.name, DEVNAME);
usb_kbd_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
usb_kbd_dev.putc = NULL;
@@ -184,7 +184,7 @@ int drv_usb_kbd_init(void)
usb_kbd_dev.getc = usb_kbd_getc;
usb_kbd_dev.tstc = usb_kbd_testc;
usb_kbd_dev.priv = (void *)dev;
- error = device_register (&usb_kbd_dev);
+ error = stdio_register (&usb_kbd_dev);
if(error==0) {
/* check if this is the standard input device */
if(strcmp(stdinname,DEVNAME)==0) {
@@ -212,8 +212,8 @@ int drv_usb_kbd_init(void)
/* deregistering the keyboard */
int usb_kbd_deregister(void)
{
-#ifdef CONFIG_SYS_DEVICE_DEREGISTER
- return device_deregister(DEVNAME);
+#ifdef CONFIG_SYS_STDIO_DEREGISTER
+ return stdio_deregister(DEVNAME);
#else
return 1;
#endif
diff --git a/cpu/blackfin/jtag-console.c b/cpu/blackfin/jtag-console.c
index d58582f..9ca1c8f 100644
--- a/cpu/blackfin/jtag-console.c
+++ b/cpu/blackfin/jtag-console.c
@@ -7,7 +7,7 @@
*/
#include <common.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <asm/blackfin.h>
#ifndef CONFIG_JTAG_CONSOLE_TIMEOUT
@@ -105,7 +105,7 @@ static int jtag_getc(void)
int drv_jtag_console_init(void)
{
- device_t dev;
+ struct stdio_dev dev;
int ret;
memset(&dev, 0x00, sizeof(dev));
@@ -116,7 +116,7 @@ int drv_jtag_console_init(void)
dev.tstc = jtag_tstc;
dev.getc = jtag_getc;
- ret = device_register(&dev);
+ ret = stdio_register(&dev);
return (ret == 0 ? 1 : ret);
}
diff --git a/cpu/mpc8xx/lcd.c b/cpu/mpc8xx/lcd.c
index 4474e24..4b88b21 100644
--- a/cpu/mpc8xx/lcd.c
+++ b/cpu/mpc8xx/lcd.c
@@ -35,7 +35,7 @@
#include <stdarg.h>
#include <lcdvideo.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
#if defined(CONFIG_POST)
#include <post.h>
#endif
diff --git a/cpu/mpc8xx/video.c b/cpu/mpc8xx/video.c
index 4a59927..c79c499 100644
--- a/cpu/mpc8xx/video.c
+++ b/cpu/mpc8xx/video.c
@@ -36,7 +36,7 @@
#include <timestamp.h>
#include <i2c.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
#ifdef CONFIG_VIDEO
@@ -1287,7 +1287,7 @@ int drv_video_init (void)
{
int error, devices = 1;
- device_t videodev;
+ struct stdio_dev videodev;
video_init ((void *)(gd->fb_base)); /* Video initialization */
@@ -1301,7 +1301,7 @@ int drv_video_init (void)
videodev.putc = video_putc; /* 'putc' function */
videodev.puts = video_puts; /* 'puts' function */
- error = device_register (&videodev);
+ error = stdio_register (&videodev);
return (error == 0) ? devices : error;
}
diff --git a/cpu/pxa/pxafb.c b/cpu/pxa/pxafb.c
index 97efcb6..d56c5f0 100644
--- a/cpu/pxa/pxafb.c
+++ b/cpu/pxa/pxafb.c
@@ -32,7 +32,7 @@
#include <version.h>
#include <stdarg.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <lcd.h>
#include <asm/arch/pxa-regs.h>
diff --git a/drivers/input/keyboard.c b/drivers/input/keyboard.c
index 512b9f2..a5fbd5f 100644
--- a/drivers/input/keyboard.c
+++ b/drivers/input/keyboard.c
@@ -11,7 +11,7 @@
#include <common.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <keyboard.h>
#undef KBG_DEBUG
@@ -268,7 +268,7 @@ extern int overwrite_console (void);
int kbd_init (void)
{
int error;
- device_t kbddev ;
+ struct stdio_dev kbddev ;
char *stdinname = getenv ("stdin");
if(kbd_init_hw()==-1)
@@ -281,7 +281,7 @@ int kbd_init (void)
kbddev.getc = kbd_getc ;
kbddev.tstc = kbd_testc ;
- error = device_register (&kbddev);
+ error = stdio_register (&kbddev);
if(error==0) {
/* check if this is the standard input device */
if(strcmp(stdinname,DEVNAME)==0) {
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index b2ee5ea..f5329a5 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -23,7 +23,7 @@
#include <common.h>
#include <command.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <net.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -243,7 +243,7 @@ int nc_tstc (void)
int drv_nc_init (void)
{
- device_t dev;
+ struct stdio_dev dev;
int rc;
memset (&dev, 0, sizeof (dev));
@@ -256,7 +256,7 @@ int drv_nc_init (void)
dev.getc = nc_getc;
dev.tstc = nc_tstc;
- rc = device_register (&dev);
+ rc = stdio_register (&dev);
return (rc == 0) ? 1 : rc;
}
diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
index dca73b9..7b5ecb5 100644
--- a/drivers/serial/arm_dcc.c
+++ b/drivers/serial/arm_dcc.c
@@ -27,7 +27,7 @@
*/
#include <common.h>
-#include <devices.h>
+#include <stdio_dev.h>
#if defined(CONFIG_CPU_V6)
/*
@@ -148,7 +148,7 @@ int arm_dcc_tstc(void)
}
#ifdef CONFIG_ARM_DCC_MULTI
-static device_t arm_dcc_dev;
+static struct stdio_dev arm_dcc_dev;
int drv_arm_dcc_init(void)
{
@@ -165,6 +165,6 @@ int drv_arm_dcc_init(void)
arm_dcc_dev.putc = arm_dcc_putc; /* 'putc' function */
arm_dcc_dev.puts = arm_dcc_puts; /* 'puts' function */
- return device_register(&arm_dcc_dev);
+ return stdio_register(&arm_dcc_dev);
}
#endif
diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c
index f711d0b..cffd5a2 100644
--- a/drivers/serial/usbtty.c
+++ b/drivers/serial/usbtty.c
@@ -24,7 +24,7 @@
#include <common.h>
#include <config.h>
#include <circbuf.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include "usbtty.h"
#include "usb_cdc_acm.h"
#include "usbdescriptors.h"
@@ -70,7 +70,7 @@ static circbuf_t usbtty_output;
/*
* Instance variables
*/
-static device_t usbttydev;
+static struct stdio_dev usbttydev;
static struct usb_device_instance device_instance[1];
static struct usb_bus_instance bus_instance[1];
static struct usb_configuration_instance config_instance[NUM_CONFIGS];
@@ -570,7 +570,7 @@ int drv_usbtty_init (void)
usbttydev.putc = usbtty_putc; /* 'putc' function */
usbttydev.puts = usbtty_puts; /* 'puts' function */
- rc = device_register (&usbttydev);
+ rc = stdio_register (&usbttydev);
return (rc == 0) ? 1 : rc;
}
diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 352a0d4..656ab1e 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -770,7 +770,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe,
*/
void usb_event_poll()
{
- device_t *dev;
+ struct stdio_dev *dev;
struct usb_device *usb_kbd_dev;
struct usb_interface_descriptor *iface;
struct usb_endpoint_descriptor *ep;
@@ -778,7 +778,7 @@ void usb_event_poll()
int maxp;
/* Get the pointer to USB Keyboard device pointer */
- dev = device_get_by_name("usbkbd");
+ dev = stdio_get_by_name("usbkbd");
usb_kbd_dev = (struct usb_device *)dev->priv;
iface = &usb_kbd_dev->config.if_desc[0];
ep = &iface->ep_desc[0];
diff --git a/drivers/usb/musb/musb_hcd.h b/drivers/usb/musb/musb_hcd.h
index bb83311..2974024 100644
--- a/drivers/usb/musb/musb_hcd.h
+++ b/drivers/usb/musb/musb_hcd.h
@@ -26,7 +26,7 @@
#include "musb_core.h"
#ifdef CONFIG_USB_KEYBOARD
-#include <devices.h>
+#include <stdio_dev.h>
extern unsigned char new[];
#endif
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index bcafb27..07e6082 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -183,7 +183,7 @@ CONFIG_VIDEO_HW_CURSOR: - Uses the hardware cursor capability of the
#include <version.h>
#include <linux/types.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <video_font.h>
#if defined(CONFIG_CMD_DATE)
@@ -1344,7 +1344,7 @@ int board_video_skip(void) __attribute__((weak, alias("__board_video_skip")));
int drv_video_init (void)
{
int skip_dev_init;
- device_t console_dev;
+ struct stdio_dev console_dev;
/* Check if video initialization should be skipped */
if (board_video_skip())
@@ -1378,7 +1378,7 @@ int drv_video_init (void)
console_dev.getc = VIDEO_GETC_FCT; /* 'getc' function */
#endif /* CONFIG_VGA_AS_SINGLE_DEVICE */
- if (device_register (&console_dev) != 0)
+ if (stdio_register (&console_dev) != 0)
return 0;
/* Return success */
diff --git a/include/configs/AmigaOneG3SE.h b/include/configs/AmigaOneG3SE.h
index fe04f27..0dfb23b 100644
--- a/include/configs/AmigaOneG3SE.h
+++ b/include/configs/AmigaOneG3SE.h
@@ -363,7 +363,7 @@
#define CONFIG_USB_UHCI 1
#define CONFIG_USB_STORAGE 1
#define CONFIG_USB_KEYBOARD 1
-#define CONFIG_SYS_DEVICE_DEREGISTER 1 /* needed by CONFIG_USB_KEYBOARD */
+#define CONFIG_SYS_STDIO_DEREGISTER 1 /* needed by CONFIG_USB_KEYBOARD */
/*
* Autoboot stuff
diff --git a/include/configs/MIP405.h b/include/configs/MIP405.h
index 8315cfe..da9b1cf 100644
--- a/include/configs/MIP405.h
+++ b/include/configs/MIP405.h
@@ -415,7 +415,7 @@
#define CONFIG_USB_STORAGE
/* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER /* needs device_deregister */
+#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */
#endif
/************************************************************
* Debug support
diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h
index 1091043..c6e47cb 100644
--- a/include/configs/MPC8610HPCD.h
+++ b/include/configs/MPC8610HPCD.h
@@ -321,7 +321,7 @@
#define CONFIG_PCI_OHCI 1
#define CONFIG_USB_OHCI_NEW 1
#define CONFIG_USB_KEYBOARD 1
-#define CONFIG_SYS_DEVICE_DEREGISTER
+#define CONFIG_SYS_STDIO_DEREGISTER
#define CONFIG_SYS_USB_EVENT_POLL 1
#define CONFIG_SYS_USB_OHCI_SLOT_NAME "ohci_pci"
#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15
diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h
index d8042fb..c51f92a 100644
--- a/include/configs/MPC8641HPCN.h
+++ b/include/configs/MPC8641HPCN.h
@@ -395,7 +395,7 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
#define CONFIG_PCI_OHCI 1
#define CONFIG_USB_OHCI_NEW 1
#define CONFIG_USB_KEYBOARD 1
-#define CONFIG_SYS_DEVICE_DEREGISTER
+#define CONFIG_SYS_STDIO_DEREGISTER
#define CONFIG_SYS_USB_EVENT_POLL 1
#define CONFIG_SYS_USB_OHCI_SLOT_NAME "ohci_pci"
#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 15
diff --git a/include/configs/PIP405.h b/include/configs/PIP405.h
index e214d70..e301599 100644
--- a/include/configs/PIP405.h
+++ b/include/configs/PIP405.h
@@ -361,7 +361,7 @@
#define CONFIG_USB_STORAGE
/* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER /* needs device_deregister */
+#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */
/************************************************************
* Debug support
diff --git a/include/configs/VCMA9.h b/include/configs/VCMA9.h
index de3092d..7edea6a 100644
--- a/include/configs/VCMA9.h
+++ b/include/configs/VCMA9.h
@@ -129,7 +129,7 @@
#define CONFIG_DOS_PARTITION 1
/* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER /* needs device_deregister */
+#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */
/************************************************************
* RTC
diff --git a/include/configs/gr_ep2s60.h b/include/configs/gr_ep2s60.h
index 6f58bac..7b0a08f 100644
--- a/include/configs/gr_ep2s60.h
+++ b/include/configs/gr_ep2s60.h
@@ -87,7 +87,7 @@
#define CONFIG_CMD_USB
#define CONFIG_USB_STORAGE
/* Enable needed helper functions */
-#define CONFIG_SYS_DEVICE_DEREGISTER /* needs device_deregister */
+#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */
#endif
/*
diff --git a/include/configs/mp2usb.h b/include/configs/mp2usb.h
index 3225ce7..ac678d0 100644
--- a/include/configs/mp2usb.h
+++ b/include/configs/mp2usb.h
@@ -216,7 +216,7 @@
#define CONFIG_SYS_MAXARGS 32 /* max number of command args */
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
-#define CONFIG_SYS_DEVICE_DEREGISTER /* needs device_deregister */
+#define CONFIG_SYS_STDIO_DEREGISTER /* needs stdio_deregister */
#define CONFIG_SYS_HZ 1000
#define CONFIG_SYS_HZ_CLOCK (AT91C_MASTER_CLOCK/2) /* AT91C_TC0_CMR is implicitly set to */
diff --git a/include/console.h b/include/console.h
deleted file mode 100644
index bc8b139..0000000
--- a/include/console.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * (C) Copyright 2000
- * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio(a)tin.it
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef _CONSOLE_H_
-#define _CONSOLE_H_
-
-#include <devices.h>
-
-/*
-** VARIABLES
-*/
-
-extern device_t *stdio_devices[] ;
-extern char *stdio_names[MAX_FILES] ;
-
-#endif
diff --git a/include/iomux.h b/include/iomux.h
index 257c1f7..e38a81e 100644
--- a/include/iomux.h
+++ b/include/iomux.h
@@ -24,7 +24,7 @@
#ifndef _IO_MUX_H
#define _IO_MUX_H
-#include <devices.h>
+#include <stdio_dev.h>
/*
* Stuff required to support console multiplexing.
@@ -34,7 +34,7 @@
* Pointers to devices used for each file type. Defined in console.c
* but storage is allocated in iomux.c.
*/
-extern device_t **console_devices[MAX_FILES];
+extern struct stdio_dev **console_devices[MAX_FILES];
/*
* The count of devices assigned to each FILE. Defined in console.c
* and populated in iomux.c.
@@ -43,6 +43,6 @@ extern int cd_count[MAX_FILES];
int iomux_doenv(const int, const char *);
void iomux_printdevs(const int);
-device_t *search_device(int, char *);
+struct stdio_dev *search_device(int, char *);
#endif /* _IO_MUX_H */
diff --git a/include/serial.h b/include/serial.h
index e3d8b36..295d4ce 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -47,7 +47,7 @@ extern struct serial_device serial_btuart_device;
extern struct serial_device serial_stuart_device;
extern void serial_initialize(void);
-extern void serial_devices_init(void);
+extern void serial_stdio_init(void);
extern int serial_assign(char * name);
extern void serial_reinit_all(void);
diff --git a/include/devices.h b/include/stdio_dev.h
similarity index 85%
rename from include/devices.h
rename to include/stdio_dev.h
index 3a9881b..8b06ccf 100644
--- a/include/devices.h
+++ b/include/stdio_dev.h
@@ -12,7 +12,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
@@ -21,13 +21,13 @@
* MA 02111-1307 USA
*/
-#include <linux/list.h>
+#ifndef _STDIO_DEV_H_
+#define _STDIO_DEV_H_
-#ifndef _DEVICES_H_
-#define _DEVICES_H_
+#include <linux/list.h>
/*
- * CONSOLE DEVICES
+ * STDIO DEVICES
*/
#define DEV_FLAGS_INPUT 0x00000001 /* Device can be used as input console */
@@ -36,7 +36,7 @@
#define DEV_EXT_VIDEO 0x00000001 /* Video extensions supported */
/* Device information */
-typedef struct {
+struct stdio_dev {
int flags; /* Device flags: input/output/system */
int ext; /* Supported extensions */
char name[16]; /* Device name */
@@ -60,7 +60,7 @@ typedef struct {
void *priv; /* Private extensions */
struct list_head list;
-} device_t;
+};
/*
* VIDEO EXTENSIONS
@@ -83,20 +83,20 @@ typedef struct {
/*
* VARIABLES
*/
-extern device_t *stdio_devices[];
+extern struct stdio_dev *stdio_devices[];
extern char *stdio_names[MAX_FILES];
/*
* PROTOTYPES
*/
-int device_register (device_t * dev);
-int devices_init (void);
-#ifdef CONFIG_SYS_DEVICE_DEREGISTER
-int device_deregister(char *devname);
+int stdio_register (struct stdio_dev * dev);
+int stdio_init (void);
+#ifdef CONFIG_SYS_STDIO_DEREGISTER
+int stdio_deregister(char *devname);
#endif
-struct list_head* device_get_list(void);
-device_t* device_get_by_name(char* name);
-device_t* device_clone(device_t *dev);
+struct list_head* stdio_get_list(void);
+struct stdio_dev* stdio_get_by_name(char* name);
+struct stdio_dev* stdio_clone(struct stdio_dev *dev);
#ifdef CONFIG_ARM_DCC_MULTI
int drv_arm_dcc_init(void);
@@ -123,4 +123,4 @@ int drv_nc_init (void);
int drv_jtag_console_init (void);
#endif
-#endif /* _DEVICES_H_ */
+#endif
diff --git a/lib_arm/board.c b/lib_arm/board.c
index d86ed22..1d5ffc2 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -41,7 +41,7 @@
#include <common.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <timestamp.h>
#include <version.h>
#include <net.h>
@@ -389,7 +389,7 @@ void start_armboot (void)
/* IP Address */
gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
- devices_init (); /* get the devices list going. */
+ stdio_init (); /* get the devices list going. */
jumptable_init ();
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 57115df..5b2d0ef 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -22,7 +22,7 @@
#include <common.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <timestamp.h>
#include <version.h>
#include <net.h>
@@ -350,7 +350,7 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
- devices_init();
+ stdio_init();
jumptable_init();
console_init_r();
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 047f164..28de372 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -11,7 +11,7 @@
#include <common.h>
#include <command.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <environment.h>
#include <malloc.h>
#include <net.h>
@@ -354,8 +354,8 @@ void board_init_r(gd_t * id, ulong dest_addr)
/* relocate environment function pointers etc. */
env_relocate();
- /* Initialize devices */
- devices_init();
+ /* Initialize stdio devices */
+ stdio_init();
jumptable_init();
/* Initialize the console (after the relocation and devices init) */
diff --git a/lib_blackfin/post.c b/lib_blackfin/post.c
index 35ccd3c..faf6b96 100644
--- a/lib_blackfin/post.c
+++ b/lib_blackfin/post.c
@@ -22,7 +22,7 @@
*/
#include <common.h>
-#include <console.h>
+#include <stdio_dev.h>
#include <watchdog.h>
#include <post.h>
diff --git a/lib_i386/board.c b/lib_i386/board.c
index e18dfa5..54ef6e7 100644
--- a/lib_i386/board.c
+++ b/lib_i386/board.c
@@ -31,7 +31,7 @@
#include <common.h>
#include <watchdog.h>
#include <command.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <timestamp.h>
#include <version.h>
#include <malloc.h>
@@ -299,7 +299,7 @@ void start_i386boot (void)
show_boot_progress(0x27);
- devices_init ();
+ stdio_init ();
jumptable_init ();
diff --git a/lib_i386/video.c b/lib_i386/video.c
index cd89457..c58ed10 100644
--- a/lib_i386/video.c
+++ b/lib_i386/video.c
@@ -23,7 +23,7 @@
#include <common.h>
#include <pci.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <i8042.h>
#include <asm/ptrace.h>
#include <asm/realmode.h>
@@ -168,8 +168,8 @@ int video_init(void)
{
u16 pos;
- static device_t vga_dev;
- static device_t kbd_dev;
+ static struct stdio_dev vga_dev;
+ static struct stdio_dev kbd_dev;
vidmem = (char *) 0xb8000;
vidport = 0x3d4;
@@ -203,7 +203,7 @@ int video_init(void)
vga_dev.tstc = NULL; /* 'tstc' function */
vga_dev.getc = NULL; /* 'getc' function */
- if (device_register(&vga_dev) == 0) {
+ if (stdio_register(&vga_dev) == 0) {
return 1;
}
@@ -220,7 +220,7 @@ int video_init(void)
kbd_dev.tstc = i8042_tstc; /* 'tstc' function */
kbd_dev.getc = i8042_getc; /* 'getc' function */
- if (device_register(&kbd_dev) == 0) {
+ if (stdio_register(&kbd_dev) == 0) {
return 1;
}
return 0;
diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index 584d1ff..de96e4e 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -28,7 +28,7 @@
#include <watchdog.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <asm/immap.h>
@@ -596,8 +596,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
#endif
/** leave this here (after malloc(), environment and PCI are working) **/
- /* Initialize devices */
- devices_init ();
+ /* Initialize stdio devices */
+ stdio_init ();
/* Initialize the jump table for applications */
jumptable_init ();
diff --git a/lib_mips/board.c b/lib_mips/board.c
index f8ac234..aa5b129 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -24,7 +24,7 @@
#include <common.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <timestamp.h>
#include <version.h>
#include <net.h>
@@ -411,8 +411,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
#endif
/** leave this here (after malloc(), environment and PCI are working) **/
- /* Initialize devices */
- devices_init ();
+ /* Initialize stdio devices */
+ stdio_init ();
jumptable_init ();
diff --git a/lib_nios/board.c b/lib_nios/board.c
index 9d8eea7..cd23457 100644
--- a/lib_nios/board.c
+++ b/lib_nios/board.c
@@ -25,7 +25,7 @@
*/
#include <common.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <watchdog.h>
#include <net.h>
#ifdef CONFIG_STATUS_LED
@@ -155,7 +155,7 @@ void board_init (void)
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
WATCHDOG_RESET ();
- devices_init();
+ stdio_init();
jumptable_init();
console_init_r();
/*
diff --git a/lib_nios2/board.c b/lib_nios2/board.c
index 0677e99..b142c59 100644
--- a/lib_nios2/board.c
+++ b/lib_nios2/board.c
@@ -25,7 +25,7 @@
*/
#include <common.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <watchdog.h>
#include <net.h>
#ifdef CONFIG_STATUS_LED
@@ -161,7 +161,7 @@ void board_init (void)
bd->bi_ip_addr = getenv_IPaddr ("ipaddr");
WATCHDOG_RESET ();
- devices_init();
+ stdio_init();
jumptable_init();
console_init_r();
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index a0e6b20..c5854b1 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -25,7 +25,7 @@
#include <watchdog.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#ifdef CONFIG_8xx
#include <mpc8xx.h>
#endif
@@ -932,8 +932,8 @@ void board_init_r (gd_t *id, ulong dest_addr)
#endif
/** leave this here (after malloc(), environment and PCI are working) **/
- /* Initialize devices */
- devices_init ();
+ /* Initialize stdio devices */
+ stdio_init ();
/* Initialize the jump table for applications */
jumptable_init ();
diff --git a/lib_sh/board.c b/lib_sh/board.c
index 183110f..829455d 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -21,7 +21,7 @@
#include <common.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <timestamp.h>
#include <version.h>
#include <watchdog.h>
@@ -150,7 +150,7 @@ init_fnc_t *init_sequence[] =
sh_flash_init, /* Flash memory(NOR) init*/
INIT_FUNC_NAND_INIT/* Flash memory (NAND) init */
INIT_FUNC_PCI_INIT /* PCI init */
- devices_init,
+ stdio_init,
console_init_r,
interrupt_init,
#ifdef BOARD_LATE_INIT
diff --git a/lib_sparc/board.c b/lib_sparc/board.c
index 628d46d..d40834b 100644
--- a/lib_sparc/board.c
+++ b/lib_sparc/board.c
@@ -28,7 +28,7 @@
#include <common.h>
#include <command.h>
#include <malloc.h>
-#include <devices.h>
+#include <stdio_dev.h>
#include <config.h>
#if defined(CONFIG_CMD_IDE)
#include <ide.h>
@@ -402,8 +402,8 @@ void board_init_f(ulong bootflag)
pci_init();
#endif
- /* Initialize devices */
- devices_init();
+ /* Initialize stdio devices */
+ stdio_init();
/* Initialize the jump table for applications */
jumptable_init();
diff --git a/post/post.c b/post/post.c
index c982e27..bc8114e 100644
--- a/post/post.c
+++ b/post/post.c
@@ -22,7 +22,7 @@
*/
#include <common.h>
-#include <console.h>
+#include <stdio_dev.h>
#include <watchdog.h>
#include <post.h>
--
1.6.2.4
2
7
This patch includes the LPC2468 processor from NXP. Included is a
working board example.
Signed-off-by: Remco Poelstra <remco.poelstra+u-boot(a)duran-audio.com>
---
http://www.beryllium.net/~remco/u-boot.diff (144kb)
5
33