]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'master' of git://git.denx.de/u-boot-avr32
authorTom Rini <trini@ti.com>
Thu, 5 Jun 2014 15:22:17 +0000 (11:22 -0400)
committerTom Rini <trini@ti.com>
Thu, 5 Jun 2014 15:22:17 +0000 (11:22 -0400)
185 files changed:
Makefile
README
arch/arm/cpu/arm926ejs/at91/at91sam9m10g45_devices.c
arch/arm/cpu/arm926ejs/kirkwood/cpu.c
arch/arm/cpu/arm926ejs/orion5x/cpu.c
arch/arm/cpu/armv7/Makefile
arch/arm/cpu/armv7/at91/config.mk [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/Makefile [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/board.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/clock.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/clock_sun4i.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/config.mk [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/cpu_info.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/dram.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/pinmux.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/start.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/timer.c [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds [new file with mode: 0644]
arch/arm/cpu/armv7/sunxi/u-boot-spl.lds [new file with mode: 0644]
arch/arm/cpu/armv8/start.S
arch/arm/cpu/at91-common/spl.c
arch/arm/include/asm/arch-at91/at91_pmc.h
arch/arm/include/asm/arch-at91/at91sam9x5.h
arch/arm/include/asm/arch-at91/hardware.h
arch/arm/include/asm/arch-sunxi/clock.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/clock_sun4i.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/cpu.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/dram.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/gpio.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/mmc.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/spl.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/sys_proto.h [new file with mode: 0644]
arch/arm/include/asm/arch-sunxi/timer.h [new file with mode: 0644]
arch/arm/include/asm/arch-vf610/imx-regs.h
arch/m68k/lib/board.c
arch/powerpc/cpu/mpc8260/pci.c
arch/powerpc/cpu/mpc8260/start.S
arch/powerpc/include/asm/processor.h
arch/powerpc/lib/board.c
arch/sandbox/include/asm/gpio.h
board/abilis/tb100/Makefile [new file with mode: 0644]
board/abilis/tb100/tb100.c [new file with mode: 0644]
board/adder/Makefile [deleted file]
board/adder/adder.c [deleted file]
board/adder/u-boot.lds [deleted file]
board/ait/cam_enc_4xx/cam_enc_4xx.c
board/amcc/yucca/cmd_yucca.c
board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
board/atmel/sama5d3_xplained/sama5d3_xplained.c
board/eltec/elppc/misc.c
board/eltec/mhpc/mhpc.c
board/ep8248/Makefile [deleted file]
board/ep8248/ep8248.c [deleted file]
board/etin/debris/Makefile [deleted file]
board/etin/debris/debris.c [deleted file]
board/etin/debris/flash.c [deleted file]
board/etin/debris/phantom.c [deleted file]
board/etin/kvme080/Makefile [deleted file]
board/etin/kvme080/kvme080.c [deleted file]
board/etin/kvme080/multiverse.c [deleted file]
board/etin/kvme080/multiverse.h [deleted file]
board/freescale/mpc8260ads/Makefile [deleted file]
board/freescale/mpc8260ads/flash.c [deleted file]
board/freescale/mpc8260ads/mpc8260ads.c [deleted file]
board/freescale/vf610twr/vf610twr.c
board/hidden_dragon/Makefile [deleted file]
board/hidden_dragon/README [deleted file]
board/hidden_dragon/flash.c [deleted file]
board/hidden_dragon/hidden_dragon.c [deleted file]
board/hymod/hymod.c
board/hymod/input.c
board/ispan/Makefile [deleted file]
board/ispan/ispan.c [deleted file]
board/keymile/common/common.c
board/keymile/common/ivm.c
board/mcc200/auto_update.c
board/quad100hd/Makefile [deleted file]
board/quad100hd/nand.c [deleted file]
board/quad100hd/quad100hd.c [deleted file]
board/rattler/Makefile [deleted file]
board/rattler/rattler.c [deleted file]
board/sunxi/Makefile [new file with mode: 0644]
board/sunxi/board.c [new file with mode: 0644]
board/sunxi/dram_cubietruck.c [new file with mode: 0644]
board/sunxi/gmac.c [new file with mode: 0644]
board/zpc1900/Makefile [deleted file]
board/zpc1900/zpc1900.c [deleted file]
boards.cfg
common/Makefile
common/autoboot.c [new file with mode: 0644]
common/board_r.c
common/bootretry.c [new file with mode: 0644]
common/cli.c [new file with mode: 0644]
common/cli_hush.c [moved from common/hush.c with 99% similarity]
common/cli_readline.c [new file with mode: 0644]
common/cli_simple.c [new file with mode: 0644]
common/cmd_bedbug.c
common/cmd_bootm.c
common/cmd_bootmenu.c
common/cmd_dcr.c
common/cmd_demo.c
common/cmd_gpio.c
common/cmd_i2c.c
common/cmd_mem.c
common/cmd_nvedit.c
common/cmd_pci.c
common/image.c
common/main.c
common/menu.c
doc/README.atmel_pmecc
doc/README.scrapyard
doc/driver-model/README.txt
drivers/core/device.c
drivers/core/lists.c
drivers/core/root.c
drivers/core/uclass.c
drivers/ddr/fsl/interactive.c
drivers/demo/demo-shape.c
drivers/demo/demo-simple.c
drivers/demo/demo-uclass.c
drivers/gpio/at91_gpio.c
drivers/gpio/gpio-uclass.c
drivers/gpio/sandbox.c
drivers/mmc/Makefile
drivers/mmc/gen_atmel_mci.c
drivers/mmc/sunxi_mmc.c [new file with mode: 0644]
drivers/net/designware.c
drivers/net/designware.h
include/asm-generic/global_data.h
include/asm-generic/gpio.h
include/autoboot.h [new file with mode: 0644]
include/bootretry.h [new file with mode: 0644]
include/cli.h [new file with mode: 0644]
include/cli_hush.h [moved from include/hush.h with 93% similarity]
include/common.h
include/configs/Adder.h [deleted file]
include/configs/HIDDEN_DRAGON.h [deleted file]
include/configs/ISPAN.h [deleted file]
include/configs/MPC8260ADS.h [deleted file]
include/configs/Rattler.h [deleted file]
include/configs/ZPC1900.h [deleted file]
include/configs/at91sam9m10g45ek.h
include/configs/at91sam9n12ek.h
include/configs/at91sam9x5ek.h
include/configs/corvus.h
include/configs/cpu9260.h
include/configs/debris.h [deleted file]
include/configs/ep8248.h [deleted file]
include/configs/ethernut5.h
include/configs/highbank.h
include/configs/kvme080.h [deleted file]
include/configs/lsxl.h
include/configs/quad100hd.h [deleted file]
include/configs/sama5d3_xplained.h
include/configs/sama5d3xek.h
include/configs/sun7i.h [new file with mode: 0644]
include/configs/sunxi-common.h [new file with mode: 0644]
include/configs/tb100.h [new file with mode: 0644]
include/configs/vl_ma2sc.h
include/dm-demo.h
include/dm/device-internal.h
include/dm/device.h
include/dm/lists.h
include/dm/root.h
include/dm/test.h
include/dm/uclass-internal.h
include/dm/uclass.h
include/image.h
include/mpc8260.h
include/netdev.h
spl/Makefile
test/dm/cmd_dm.c
test/dm/core.c
test/dm/gpio.c
test/dm/test-driver.c
test/dm/test-fdt.c
test/dm/test-main.c
test/dm/test-uclass.c
tools/.gitignore
tools/Makefile
tools/atmel_pmecc_params.c [new file with mode: 0644]
tools/atmelimage.c [new file with mode: 0644]
tools/imagetool.c
tools/imagetool.h
tools/mksunxiboot.c [new file with mode: 0644]

index 928a8808b6024a25d679a237ee3e52db5522d4a8..1df3f707cb461a0edfa00ed85cd60e17171176b0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@
 VERSION = 2014
 PATCHLEVEL = 07
 SUBLEVEL =
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc2
 NAME =
 
 # *DOCUMENTATION*
@@ -937,6 +937,13 @@ OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO)
 u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE
        $(call if_changed,pad_cat)
 
+ifneq ($(CONFIG_SUNXI),)
+OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \
+                                  --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
+u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img FORCE
+       $(call if_changed,pad_cat)
+endif
+
 ifneq ($(CONFIG_TEGRA),)
 OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE)
 u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE
@@ -1163,6 +1170,9 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 spl/u-boot-spl: tools prepare
        $(Q)$(MAKE) obj=spl -f $(srctree)/spl/Makefile all
 
+spl/sunxi-spl.bin: spl/u-boot-spl
+       @:
+
 tpl/u-boot-tpl.bin: tools prepare
        $(Q)$(MAKE) obj=tpl -f $(srctree)/spl/Makefile all CONFIG_TPL_BUILD=y
 
diff --git a/README b/README
index a280435e9fbec65012cf9758a66f6827d2f22353..6edb2e75be87e104ce707430abdb137863d0a211 100644 (file)
--- a/README
+++ b/README
@@ -321,14 +321,6 @@ The following options need to be configured:
                                          the LCD display every second with
                                          a "rotator" |\-/|\-/
 
-- Board flavour: (if CONFIG_MPC8260ADS is defined)
-               CONFIG_ADSTYPE
-               Possible values are:
-                       CONFIG_SYS_8260ADS      - original MPC8260ADS
-                       CONFIG_SYS_8266ADS      - MPC8266ADS
-                       CONFIG_SYS_PQ2FADS      - PQ2FADS-ZU or PQ2FADS-VR
-                       CONFIG_SYS_8272ADS      - MPC8272ADS
-
 - Marvell Family Member
                CONFIG_SYS_MVFS         - define it if you want to enable
                                          multiple fs option at one time
index 7d7725c4b831392c3bddff515f9df574de44cf9f..0e6c0da1bdd4cfeefb2c7f3e20d207550b76c4c6 100644 (file)
@@ -165,3 +165,20 @@ void at91_macb_hw_init(void)
 #endif
 }
 #endif
+
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+void at91_mci_hw_init(void)
+{
+       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+
+       at91_set_a_periph(AT91_PIO_PORTA, 0, 0);        /* MCI0 CLK */
+       at91_set_a_periph(AT91_PIO_PORTA, 1, 0);        /* MCI0 CDA */
+       at91_set_a_periph(AT91_PIO_PORTA, 2, 0);        /* MCI0 DA0 */
+       at91_set_a_periph(AT91_PIO_PORTA, 3, 0);        /* MCI0 DA1 */
+       at91_set_a_periph(AT91_PIO_PORTA, 4, 0);        /* MCI0 DA2 */
+       at91_set_a_periph(AT91_PIO_PORTA, 5, 0);        /* MCI0 DA3 */
+
+       /* Enable clock */
+       writel(1 << ATMEL_ID_MCI0, &pmc->pcer);
+}
+#endif
index d4711c070c3ddaef84740c608d75cb0d6c5617bd..093750626886d48c1c3f3a99077506eb21c2d0e2 100644 (file)
@@ -13,7 +13,6 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/kirkwood.h>
-#include <hush.h>
 
 #define BUFLEN 16
 
index b55c5f09433b776614cefa407be521a2a3446c58..f88db3b1f96ad400fdf47c0e3bbd83f91a46ed6a 100644 (file)
@@ -15,7 +15,6 @@
 #include <asm/io.h>
 #include <u-boot/md5.h>
 #include <asm/arch/cpu.h>
-#include <hush.h>
 
 #define BUFLEN 16
 
index ab869b1ee87d1f0b031ccfe2bdd7e5b6f5bbdf94..232118d7f4135475c3489787211b3a04fe254080 100644 (file)
@@ -12,7 +12,7 @@ obj-y += cache_v7.o
 obj-y  += cpu.o
 obj-y  += syslib.o
 
-ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY),)
+ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI),)
 ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y)
 obj-y  += lowlevel_init.o
 endif
diff --git a/arch/arm/cpu/armv7/at91/config.mk b/arch/arm/cpu/armv7/at91/config.mk
new file mode 100644 (file)
index 0000000..09eab70
--- /dev/null
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2014, Andreas Bießmann <andreas.devel@googlemail.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+ifdef CONFIG_SPL_BUILD
+ALL-y  += boot.bin
+else
+ALL-y  += u-boot.img
+endif
diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile
new file mode 100644 (file)
index 0000000..a64bfa1
--- /dev/null
@@ -0,0 +1,25 @@
+#
+# (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
+#
+# Based on some other Makefile
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+obj-y  += timer.o
+obj-y  += board.o
+obj-y  += clock.o
+obj-y  += pinmux.o
+obj-$(CONFIG_SUN7I)    += clock_sun4i.o
+
+ifndef CONFIG_SPL_BUILD
+obj-y  += cpu_info.o
+endif
+
+ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SUN7I)    += dram.o
+ifdef CONFIG_SPL_FEL
+obj-y  += start.o
+endif
+endif
diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
new file mode 100644 (file)
index 0000000..49c9448
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
+ *
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Some init for sunxi platform.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <netdev.h>
+#include <miiphy.h>
+#include <serial.h>
+#ifdef CONFIG_SPL_BUILD
+#include <spl.h>
+#endif
+#include <asm/gpio.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/timer.h>
+
+#ifdef CONFIG_SPL_BUILD
+/* Pointer to the global data structure for SPL */
+DECLARE_GLOBAL_DATA_PTR;
+
+/* The sunxi internal brom will try to loader external bootloader
+ * from mmc0, nand flash, mmc2.
+ * Unfortunately we can't check how SPL was loaded so assume
+ * it's always the first SD/MMC controller
+ */
+u32 spl_boot_device(void)
+{
+       return BOOT_DEVICE_MMC1;
+}
+
+/* No confirmation data available in SPL yet. Hardcode bootmode */
+u32 spl_boot_mode(void)
+{
+       return MMCSD_MODE_RAW;
+}
+#endif
+
+int gpio_init(void)
+{
+       sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUN4I_GPB22_UART0_TX);
+       sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUN4I_GPB23_UART0_RX);
+       sunxi_gpio_set_pull(SUNXI_GPB(23), 1);
+
+       return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+}
+
+/* do some early init */
+void s_init(void)
+{
+#if !defined CONFIG_SPL_BUILD && (defined CONFIG_SUN7I || defined CONFIG_SUN6I)
+       /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */
+       asm volatile(
+               "mrc p15, 0, r0, c1, c0, 1\n"
+               "orr r0, r0, #1 << 6\n"
+               "mcr p15, 0, r0, c1, c0, 1\n");
+#endif
+
+       clock_init();
+       timer_init();
+       gpio_init();
+
+#ifdef CONFIG_SPL_BUILD
+       gd = &gdata;
+       preloader_console_init();
+
+       sunxi_board_init();
+#endif
+}
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+       /* Enable D-cache. I-cache is already enabled in start.S */
+       dcache_enable();
+}
+#endif
+
+#ifdef CONFIG_CMD_NET
+/*
+ * Initializes on-chip ethernet controllers.
+ * to override, implement board_eth_init()
+ */
+int cpu_eth_init(bd_t *bis)
+{
+       int rc;
+
+#ifdef CONFIG_SUNXI_GMAC
+       rc = sunxi_gmac_initialize(bis);
+       if (rc < 0) {
+               printf("sunxi: failed to initialize gmac\n");
+               return rc;
+       }
+#endif
+
+       return 0;
+}
+#endif
diff --git a/arch/arm/cpu/armv7/sunxi/clock.c b/arch/arm/cpu/armv7/sunxi/clock.c
new file mode 100644 (file)
index 0000000..47fb70f
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/sys_proto.h>
+
+int clock_init(void)
+{
+#ifdef CONFIG_SPL_BUILD
+       clock_init_safe();
+#endif
+       clock_init_uart();
+
+       return 0;
+}
diff --git a/arch/arm/cpu/armv7/sunxi/clock_sun4i.c b/arch/arm/cpu/armv7/sunxi/clock_sun4i.c
new file mode 100644 (file)
index 0000000..5a7da3c
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * sun4i, sun5i and sun7i specific clock code
+ *
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/sys_proto.h>
+
+#ifdef CONFIG_SPL_BUILD
+void clock_init_safe(void)
+{
+       struct sunxi_ccm_reg * const ccm =
+               (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       /* Set safe defaults until PMU is configured */
+       writel(AXI_DIV_1 << AXI_DIV_SHIFT |
+              AHB_DIV_2 << AHB_DIV_SHIFT |
+              APB0_DIV_1 << APB0_DIV_SHIFT |
+              CPU_CLK_SRC_OSC24M << CPU_CLK_SRC_SHIFT,
+              &ccm->cpu_ahb_apb0_cfg);
+       writel(PLL1_CFG_DEFAULT, &ccm->pll1_cfg);
+       sdelay(200);
+       writel(AXI_DIV_1 << AXI_DIV_SHIFT |
+              AHB_DIV_2 << AHB_DIV_SHIFT |
+              APB0_DIV_1 << APB0_DIV_SHIFT |
+              CPU_CLK_SRC_PLL1 << CPU_CLK_SRC_SHIFT,
+              &ccm->cpu_ahb_apb0_cfg);
+#ifdef CONFIG_SUN7I
+       writel(0x1 << AHB_GATE_OFFSET_DMA | readl(&ccm->ahb_gate0),
+              &ccm->ahb_gate0);
+#endif
+       writel(PLL6_CFG_DEFAULT, &ccm->pll6_cfg);
+}
+#endif
+
+void clock_init_uart(void)
+{
+       struct sunxi_ccm_reg *const ccm =
+               (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       /* uart clock source is apb1 */
+       writel(APB1_CLK_SRC_OSC24M|
+              APB1_CLK_RATE_N_1|
+              APB1_CLK_RATE_M(1),
+              &ccm->apb1_clk_div_cfg);
+
+       /* open the clock for uart */
+       setbits_le32(&ccm->apb1_gate,
+               CLK_GATE_OPEN << (APB1_GATE_UART_SHIFT+CONFIG_CONS_INDEX-1));
+}
+
+int clock_twi_onoff(int port, int state)
+{
+       struct sunxi_ccm_reg *const ccm =
+               (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       if (port > 2)
+               return -1;
+
+       /* set the apb clock gate for twi */
+       if (state)
+               setbits_le32(&ccm->apb1_gate,
+                            CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT+port));
+       else
+               clrbits_le32(&ccm->apb1_gate,
+                            CLK_GATE_OPEN << (APB1_GATE_TWI_SHIFT+port));
+
+       return 0;
+}
+
+#ifdef CONFIG_SPL_BUILD
+#define PLL1_CFG(N, K, M, P)   ( 1 << CCM_PLL1_CFG_ENABLE_SHIFT | \
+                                 0 << CCM_PLL1_CFG_VCO_RST_SHIFT |  \
+                                 8 << CCM_PLL1_CFG_VCO_BIAS_SHIFT | \
+                                 0 << CCM_PLL1_CFG_PLL4_EXCH_SHIFT | \
+                                16 << CCM_PLL1_CFG_BIAS_CUR_SHIFT | \
+                                (P)<< CCM_PLL1_CFG_DIVP_SHIFT | \
+                                 2 << CCM_PLL1_CFG_LCK_TMR_SHIFT | \
+                                (N)<< CCM_PLL1_CFG_FACTOR_N_SHIFT | \
+                                (K)<< CCM_PLL1_CFG_FACTOR_K_SHIFT | \
+                                 0 << CCM_PLL1_CFG_SIG_DELT_PAT_IN_SHIFT | \
+                                 0 << CCM_PLL1_CFG_SIG_DELT_PAT_EN_SHIFT | \
+                                (M)<< CCM_PLL1_CFG_FACTOR_M_SHIFT)
+
+static struct {
+       u32 pll1_cfg;
+       unsigned int freq;
+} pll1_para[] = {
+       /* This array must be ordered by frequency. */
+       { PLL1_CFG(16, 0, 0, 0), 384000000 },
+       { PLL1_CFG(16, 1, 0, 0), 768000000 },
+       { PLL1_CFG(20, 1, 0, 0), 960000000 },
+       { PLL1_CFG(21, 1, 0, 0), 1008000000},
+       { PLL1_CFG(22, 1, 0, 0), 1056000000},
+       { PLL1_CFG(23, 1, 0, 0), 1104000000},
+       { PLL1_CFG(24, 1, 0, 0), 1152000000},
+       { PLL1_CFG(25, 1, 0, 0), 1200000000},
+       { PLL1_CFG(26, 1, 0, 0), 1248000000},
+       { PLL1_CFG(27, 1, 0, 0), 1296000000},
+       { PLL1_CFG(28, 1, 0, 0), 1344000000},
+       { PLL1_CFG(29, 1, 0, 0), 1392000000},
+       { PLL1_CFG(30, 1, 0, 0), 1440000000},
+       { PLL1_CFG(31, 1, 0, 0), 1488000000},
+       /* Final catchall entry */
+       { PLL1_CFG(31, 1, 0, 0), ~0},
+};
+
+void clock_set_pll1(unsigned int hz)
+{
+       int i = 0;
+       int axi, ahb, apb0;
+       struct sunxi_ccm_reg * const ccm =
+               (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       /* Find target frequency */
+       while (pll1_para[i].freq < hz)
+               i++;
+
+       hz = pll1_para[i].freq;
+
+       /* Calculate system clock divisors */
+       axi = DIV_ROUND_UP(hz, 432000000);      /* Max 450MHz */
+       ahb = DIV_ROUND_UP(hz/axi, 204000000);  /* Max 250MHz */
+       apb0 = 2;                               /* Max 150MHz */
+
+       printf("CPU: %uHz, AXI/AHB/APB: %d/%d/%d\n", hz, axi, ahb, apb0);
+
+       /* Map divisors to register values */
+       axi = axi - 1;
+       if (ahb > 4)
+               ahb = 3;
+       else if (ahb > 2)
+               ahb = 2;
+       else if (ahb > 1)
+               ahb = 1;
+       else
+               ahb = 0;
+
+       apb0 = apb0 - 1;
+
+       /* Switch to 24MHz clock while changing PLL1 */
+       writel(AXI_DIV_1 << AXI_DIV_SHIFT |
+              AHB_DIV_2 << AHB_DIV_SHIFT |
+              APB0_DIV_1 << APB0_DIV_SHIFT |
+              CPU_CLK_SRC_OSC24M << CPU_CLK_SRC_SHIFT,
+              &ccm->cpu_ahb_apb0_cfg);
+       sdelay(20);
+
+       /* Configure sys clock divisors */
+       writel(axi << AXI_DIV_SHIFT |
+              ahb << AHB_DIV_SHIFT |
+              apb0 << APB0_DIV_SHIFT |
+              CPU_CLK_SRC_OSC24M << CPU_CLK_SRC_SHIFT,
+              &ccm->cpu_ahb_apb0_cfg);
+
+       /* Configure PLL1 at the desired frequency */
+       writel(pll1_para[i].pll1_cfg, &ccm->pll1_cfg);
+       sdelay(200);
+
+       /* Switch CPU to PLL1 */
+       writel(axi << AXI_DIV_SHIFT |
+              ahb << AHB_DIV_SHIFT |
+              apb0 << APB0_DIV_SHIFT |
+              CPU_CLK_SRC_PLL1 << CPU_CLK_SRC_SHIFT,
+              &ccm->cpu_ahb_apb0_cfg);
+       sdelay(20);
+}
+#endif
+
+unsigned int clock_get_pll6(void)
+{
+       struct sunxi_ccm_reg *const ccm =
+               (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+       uint32_t rval = readl(&ccm->pll6_cfg);
+       int n = ((rval & CCM_PLL6_CTRL_N_MASK) >> CCM_PLL6_CTRL_N_SHIFT);
+       int k = ((rval & CCM_PLL6_CTRL_K_MASK) >> CCM_PLL6_CTRL_K_SHIFT) + 1;
+       return 24000000 * n * k / 2;
+}
diff --git a/arch/arm/cpu/armv7/sunxi/config.mk b/arch/arm/cpu/armv7/sunxi/config.mk
new file mode 100644 (file)
index 0000000..00f5ffc
--- /dev/null
@@ -0,0 +1,8 @@
+# Build a combined spl + u-boot image
+ifdef CONFIG_SPL
+ifndef CONFIG_SPL_BUILD
+ifndef CONFIG_SPL_FEL
+ALL-y += u-boot-sunxi-with-spl.bin
+endif
+endif
+endif
diff --git a/arch/arm/cpu/armv7/sunxi/cpu_info.c b/arch/arm/cpu/armv7/sunxi/cpu_info.c
new file mode 100644 (file)
index 0000000..b4c3d5c
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/cpu.h>
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
+{
+       puts("CPU:   Allwinner A20 (SUN7I)\n");
+       return 0;
+}
+#endif
diff --git a/arch/arm/cpu/armv7/sunxi/dram.c b/arch/arm/cpu/armv7/sunxi/dram.c
new file mode 100644 (file)
index 0000000..b43c4b4
--- /dev/null
@@ -0,0 +1,593 @@
+/*
+ * sunxi DRAM controller initialization
+ * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+ *
+ * Based on sun4i Linux kernel sources mach-sunxi/pm/standby/dram*.c
+ * and earlier U-Boot Allwiner A10 SPL work
+ *
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Berg Xing <bergxing@allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/*
+ * Unfortunately the only documentation we have on the sun7i DRAM
+ * controller is Allwinner boot0 + boot1 code, and that code uses
+ * magic numbers & shifts with no explanations. Hence this code is
+ * rather undocumented and full of magic.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/dram.h>
+#include <asm/arch/timer.h>
+#include <asm/arch/sys_proto.h>
+
+#define CPU_CFG_CHIP_VER(n) ((n) << 6)
+#define CPU_CFG_CHIP_VER_MASK CPU_CFG_CHIP_VER(0x3)
+#define CPU_CFG_CHIP_REV_A 0x0
+#define CPU_CFG_CHIP_REV_C1 0x1
+#define CPU_CFG_CHIP_REV_C2 0x2
+#define CPU_CFG_CHIP_REV_B 0x3
+
+/*
+ * Wait up to 1s for mask to be clear in given reg.
+ */
+static void await_completion(u32 *reg, u32 mask)
+{
+       unsigned long tmo = timer_get_us() + 1000000;
+
+       while (readl(reg) & mask) {
+               if (timer_get_us() > tmo)
+                       panic("Timeout initialising DRAM\n");
+       }
+}
+
+static void mctl_ddr3_reset(void)
+{
+       struct sunxi_dram_reg *dram =
+                       (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+       clrbits_le32(&dram->mcr, DRAM_MCR_RESET);
+       udelay(2);
+       setbits_le32(&dram->mcr, DRAM_MCR_RESET);
+}
+
+static void mctl_set_drive(void)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+       clrsetbits_le32(&dram->mcr, DRAM_MCR_MODE_NORM(0x3) | (0x3 << 28),
+                       DRAM_MCR_MODE_EN(0x3) |
+                       0xffc);
+}
+
+static void mctl_itm_disable(void)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+       clrsetbits_le32(&dram->ccr, DRAM_CCR_INIT, DRAM_CCR_ITM_OFF);
+}
+
+static void mctl_itm_enable(void)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+       clrbits_le32(&dram->ccr, DRAM_CCR_ITM_OFF);
+}
+
+static void mctl_enable_dll0(u32 phase)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+       clrsetbits_le32(&dram->dllcr[0], 0x3f << 6,
+                       ((phase >> 16) & 0x3f) << 6);
+       clrsetbits_le32(&dram->dllcr[0], DRAM_DLLCR_NRESET, DRAM_DLLCR_DISABLE);
+       udelay(2);
+
+       clrbits_le32(&dram->dllcr[0], DRAM_DLLCR_NRESET | DRAM_DLLCR_DISABLE);
+       udelay(22);
+
+       clrsetbits_le32(&dram->dllcr[0], DRAM_DLLCR_DISABLE, DRAM_DLLCR_NRESET);
+       udelay(22);
+}
+
+/*
+ * Note: This differs from pm/standby in that it checks the bus width
+ */
+static void mctl_enable_dllx(u32 phase)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+       u32 i, n, bus_width;
+
+       bus_width = readl(&dram->dcr);
+
+       if ((bus_width & DRAM_DCR_BUS_WIDTH_MASK) ==
+           DRAM_DCR_BUS_WIDTH(DRAM_DCR_BUS_WIDTH_32BIT))
+               n = DRAM_DCR_NR_DLLCR_32BIT;
+       else
+               n = DRAM_DCR_NR_DLLCR_16BIT;
+
+       for (i = 1; i < n; i++) {
+               clrsetbits_le32(&dram->dllcr[i], 0xf << 14,
+                               (phase & 0xf) << 14);
+               clrsetbits_le32(&dram->dllcr[i], DRAM_DLLCR_NRESET,
+                               DRAM_DLLCR_DISABLE);
+               phase >>= 4;
+       }
+       udelay(2);
+
+       for (i = 1; i < n; i++)
+               clrbits_le32(&dram->dllcr[i], DRAM_DLLCR_NRESET |
+                            DRAM_DLLCR_DISABLE);
+       udelay(22);
+
+       for (i = 1; i < n; i++)
+               clrsetbits_le32(&dram->dllcr[i], DRAM_DLLCR_DISABLE,
+                               DRAM_DLLCR_NRESET);
+       udelay(22);
+}
+
+static u32 hpcr_value[32] = {
+#ifdef CONFIG_SUN7I
+       0x0301, 0x0301, 0x0301, 0x0301,
+       0x0301, 0x0301, 0x0301, 0x0301,
+       0, 0, 0, 0,
+       0, 0, 0, 0,
+       0x1031, 0x1031, 0x0735, 0x1035,
+       0x1035, 0x0731, 0x1031, 0x0735,
+       0x1035, 0x1031, 0x0731, 0x1035,
+       0x0001, 0x1031, 0, 0x1031
+       /* last row differs from boot0 source table
+        * 0x1031, 0x0301, 0x0301, 0x0731
+        * but boot0 code skips #28 and #30, and sets #29 and #31 to the
+        * value from #28 entry (0x1031)
+        */
+#endif
+};
+
+static void mctl_configure_hostport(void)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+       u32 i;
+
+       for (i = 0; i < 32; i++)
+               writel(hpcr_value[i], &dram->hpcr[i]);
+}
+
+static void mctl_setup_dram_clock(u32 clk)
+{
+       u32 reg_val;
+       struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       /* setup DRAM PLL */
+       reg_val = readl(&ccm->pll5_cfg);
+       reg_val &= ~CCM_PLL5_CTRL_M_MASK;               /* set M to 0 (x1) */
+       reg_val &= ~CCM_PLL5_CTRL_K_MASK;               /* set K to 0 (x1) */
+       reg_val &= ~CCM_PLL5_CTRL_N_MASK;               /* set N to 0 (x0) */
+       reg_val &= ~CCM_PLL5_CTRL_P_MASK;               /* set P to 0 (x1) */
+       if (clk >= 540 && clk < 552) {
+               /* dram = 540MHz, pll5p = 540MHz */
+               reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(2));
+               reg_val |= CCM_PLL5_CTRL_K(CCM_PLL5_CTRL_K_X(3));
+               reg_val |= CCM_PLL5_CTRL_N(CCM_PLL5_CTRL_N_X(15));
+               reg_val |= CCM_PLL5_CTRL_P(1);
+       } else if (clk >= 512 && clk < 528) {
+               /* dram = 512MHz, pll5p = 384MHz */
+               reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(3));
+               reg_val |= CCM_PLL5_CTRL_K(CCM_PLL5_CTRL_K_X(4));
+               reg_val |= CCM_PLL5_CTRL_N(CCM_PLL5_CTRL_N_X(16));
+               reg_val |= CCM_PLL5_CTRL_P(2);
+       } else if (clk >= 496 && clk < 504) {
+               /* dram = 496MHz, pll5p = 372MHz */
+               reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(3));
+               reg_val |= CCM_PLL5_CTRL_K(CCM_PLL5_CTRL_K_X(2));
+               reg_val |= CCM_PLL5_CTRL_N(CCM_PLL5_CTRL_N_X(31));
+               reg_val |= CCM_PLL5_CTRL_P(2);
+       } else if (clk >= 468 && clk < 480) {
+               /* dram = 468MHz, pll5p = 468MHz */
+               reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(2));
+               reg_val |= CCM_PLL5_CTRL_K(CCM_PLL5_CTRL_K_X(3));
+               reg_val |= CCM_PLL5_CTRL_N(CCM_PLL5_CTRL_N_X(13));
+               reg_val |= CCM_PLL5_CTRL_P(1);
+       } else if (clk >= 396 && clk < 408) {
+               /* dram = 396MHz, pll5p = 396MHz */
+               reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(2));
+               reg_val |= CCM_PLL5_CTRL_K(CCM_PLL5_CTRL_K_X(3));
+               reg_val |= CCM_PLL5_CTRL_N(CCM_PLL5_CTRL_N_X(11));
+               reg_val |= CCM_PLL5_CTRL_P(1);
+       } else  {
+               /* any other frequency that is a multiple of 24 */
+               reg_val |= CCM_PLL5_CTRL_M(CCM_PLL5_CTRL_M_X(2));
+               reg_val |= CCM_PLL5_CTRL_K(CCM_PLL5_CTRL_K_X(2));
+               reg_val |= CCM_PLL5_CTRL_N(CCM_PLL5_CTRL_N_X(clk / 24));
+               reg_val |= CCM_PLL5_CTRL_P(CCM_PLL5_CTRL_P_X(2));
+       }
+       reg_val &= ~CCM_PLL5_CTRL_VCO_GAIN;             /* PLL VCO Gain off */
+       reg_val |= CCM_PLL5_CTRL_EN;                    /* PLL On */
+       writel(reg_val, &ccm->pll5_cfg);
+       udelay(5500);
+
+       setbits_le32(&ccm->pll5_cfg, CCM_PLL5_CTRL_DDR_CLK);
+
+#if defined(CONFIG_SUN4I) || defined(CONFIG_SUN7I)
+       /* reset GPS */
+       clrbits_le32(&ccm->gps_clk_cfg, CCM_GPS_CTRL_RESET | CCM_GPS_CTRL_GATE);
+       setbits_le32(&ccm->ahb_gate0, CCM_AHB_GATE_GPS);
+       udelay(1);
+       clrbits_le32(&ccm->ahb_gate0, CCM_AHB_GATE_GPS);
+#endif
+
+       /* setup MBUS clock */
+       reg_val = CCM_MBUS_CTRL_GATE |
+                 CCM_MBUS_CTRL_CLK_SRC(CCM_MBUS_CTRL_CLK_SRC_PLL6) |
+                 CCM_MBUS_CTRL_N(CCM_MBUS_CTRL_N_X(2)) |
+                 CCM_MBUS_CTRL_M(CCM_MBUS_CTRL_M_X(2));
+       writel(reg_val, &ccm->mbus_clk_cfg);
+
+       /*
+        * open DRAMC AHB & DLL register clock
+        * close it first
+        */
+       clrbits_le32(&ccm->ahb_gate0, CCM_AHB_GATE_SDRAM | CCM_AHB_GATE_DLL);
+       udelay(22);
+
+       /* then open it */
+       setbits_le32(&ccm->ahb_gate0, CCM_AHB_GATE_SDRAM | CCM_AHB_GATE_DLL);
+       udelay(22);
+}
+
+static int dramc_scan_readpipe(void)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+       u32 reg_val;
+
+       /* data training trigger */
+#ifdef CONFIG_SUN7I
+       clrbits_le32(&dram->csr, DRAM_CSR_FAILED);
+#endif
+       setbits_le32(&dram->ccr, DRAM_CCR_DATA_TRAINING);
+
+       /* check whether data training process has completed */
+       await_completion(&dram->ccr, DRAM_CCR_DATA_TRAINING);
+
+       /* check data training result */
+       reg_val = readl(&dram->csr);
+       if (reg_val & DRAM_CSR_FAILED)
+               return -1;
+
+       return 0;
+}
+
+static int dramc_scan_dll_para(void)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+       const u32 dqs_dly[7] = {0x3, 0x2, 0x1, 0x0, 0xe, 0xd, 0xc};
+       const u32 clk_dly[15] = {0x07, 0x06, 0x05, 0x04, 0x03,
+                                0x02, 0x01, 0x00, 0x08, 0x10,
+                                0x18, 0x20, 0x28, 0x30, 0x38};
+       u32 clk_dqs_count[15];
+       u32 dqs_i, clk_i, cr_i;
+       u32 max_val, min_val;
+       u32 dqs_index, clk_index;
+
+       /* Find DQS_DLY Pass Count for every CLK_DLY */
+       for (clk_i = 0; clk_i < 15; clk_i++) {
+               clk_dqs_count[clk_i] = 0;
+               clrsetbits_le32(&dram->dllcr[0], 0x3f << 6,
+                               (clk_dly[clk_i] & 0x3f) << 6);
+               for (dqs_i = 0; dqs_i < 7; dqs_i++) {
+                       for (cr_i = 1; cr_i < 5; cr_i++) {
+                               clrsetbits_le32(&dram->dllcr[cr_i],
+                                               0x4f << 14,
+                                               (dqs_dly[dqs_i] & 0x4f) << 14);
+                       }
+                       udelay(2);
+                       if (dramc_scan_readpipe() == 0)
+                               clk_dqs_count[clk_i]++;
+               }
+       }
+       /* Test DQS_DLY Pass Count for every CLK_DLY from up to down */
+       for (dqs_i = 15; dqs_i > 0; dqs_i--) {
+               max_val = 15;
+               min_val = 15;
+               for (clk_i = 0; clk_i < 15; clk_i++) {
+                       if (clk_dqs_count[clk_i] == dqs_i) {
+                               max_val = clk_i;
+                               if (min_val == 15)
+                                       min_val = clk_i;
+                       }
+               }
+               if (max_val < 15)
+                       break;
+       }
+
+       /* Check if Find a CLK_DLY failed */
+       if (!dqs_i)
+               goto fail;
+
+       /* Find the middle index of CLK_DLY */
+       clk_index = (max_val + min_val) >> 1;
+       if ((max_val == (15 - 1)) && (min_val > 0))
+               /* if CLK_DLY[MCTL_CLK_DLY_COUNT] is very good, then the middle
+                * value can be more close to the max_val
+                */
+               clk_index = (15 + clk_index) >> 1;
+       else if ((max_val < (15 - 1)) && (min_val == 0))
+               /* if CLK_DLY[0] is very good, then the middle value can be more
+                * close to the min_val
+                */
+               clk_index >>= 1;
+       if (clk_dqs_count[clk_index] < dqs_i)
+               clk_index = min_val;
+
+       /* Find the middle index of DQS_DLY for the CLK_DLY got above, and Scan
+        * read pipe again
+        */
+       clrsetbits_le32(&dram->dllcr[0], 0x3f << 6,
+                       (clk_dly[clk_index] & 0x3f) << 6);
+       max_val = 7;
+       min_val = 7;
+       for (dqs_i = 0; dqs_i < 7; dqs_i++) {
+               clk_dqs_count[dqs_i] = 0;
+               for (cr_i = 1; cr_i < 5; cr_i++) {
+                       clrsetbits_le32(&dram->dllcr[cr_i],
+                                       0x4f << 14,
+                                       (dqs_dly[dqs_i] & 0x4f) << 14);
+               }
+               udelay(2);
+               if (dramc_scan_readpipe() == 0) {
+                       clk_dqs_count[dqs_i] = 1;
+                       max_val = dqs_i;
+                       if (min_val == 7)
+                               min_val = dqs_i;
+               }
+       }
+
+       if (max_val < 7) {
+               dqs_index = (max_val + min_val) >> 1;
+               if ((max_val == (7-1)) && (min_val > 0))
+                       dqs_index = (7 + dqs_index) >> 1;
+               else if ((max_val < (7-1)) && (min_val == 0))
+                       dqs_index >>= 1;
+               if (!clk_dqs_count[dqs_index])
+                       dqs_index = min_val;
+               for (cr_i = 1; cr_i < 5; cr_i++) {
+                       clrsetbits_le32(&dram->dllcr[cr_i],
+                                       0x4f << 14,
+                                       (dqs_dly[dqs_index] & 0x4f) << 14);
+               }
+               udelay(2);
+               return dramc_scan_readpipe();
+       }
+
+fail:
+       clrbits_le32(&dram->dllcr[0], 0x3f << 6);
+       for (cr_i = 1; cr_i < 5; cr_i++)
+               clrbits_le32(&dram->dllcr[cr_i], 0x4f << 14);
+       udelay(2);
+
+       return dramc_scan_readpipe();
+}
+
+static void dramc_clock_output_en(u32 on)
+{
+#if defined(CONFIG_SUN5I) || defined(CONFIG_SUN7I)
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+
+       if (on)
+               setbits_le32(&dram->mcr, DRAM_MCR_DCLK_OUT);
+       else
+               clrbits_le32(&dram->mcr, DRAM_MCR_DCLK_OUT);
+#endif
+}
+
+static const u16 tRFC_table[2][6] = {
+       /*       256Mb    512Mb    1Gb      2Gb      4Gb      8Gb      */
+       /* DDR2  75ns     105ns    127.5ns  195ns    327.5ns  invalid  */
+       {        77,      108,     131,     200,     336,     336 },
+       /* DDR3  invalid  90ns     110ns    160ns    300ns    350ns    */
+       {        93,      93,      113,     164,     308,     359 }
+};
+
+static void dramc_set_autorefresh_cycle(u32 clk, u32 type, u32 density)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+       u32 tRFC, tREFI;
+
+       tRFC = (tRFC_table[type][density] * clk + 1023) >> 10;
+       tREFI = (7987 * clk) >> 10;     /* <= 7.8us */
+
+       writel(DRAM_DRR_TREFI(tREFI) | DRAM_DRR_TRFC(tRFC), &dram->drr);
+}
+
+unsigned long dramc_init(struct dram_para *para)
+{
+       struct sunxi_dram_reg *dram = (struct sunxi_dram_reg *)SUNXI_DRAMC_BASE;
+       u32 reg_val;
+       u32 density;
+       int ret_val;
+
+       /* check input dram parameter structure */
+       if (!para)
+               return 0;
+
+       /* setup DRAM relative clock */
+       mctl_setup_dram_clock(para->clock);
+
+       /* reset external DRAM */
+       mctl_set_drive();
+
+       /* dram clock off */
+       dramc_clock_output_en(0);
+
+       mctl_itm_disable();
+       mctl_enable_dll0(para->tpr3);
+
+       /* configure external DRAM */
+       reg_val = 0x0;
+       if (para->type == DRAM_MEMORY_TYPE_DDR3)
+               reg_val |= DRAM_DCR_TYPE_DDR3;
+       reg_val |= DRAM_DCR_IO_WIDTH(para->io_width >> 3);
+
+       if (para->density == 256)
+               density = DRAM_DCR_CHIP_DENSITY_256M;
+       else if (para->density == 512)
+               density = DRAM_DCR_CHIP_DENSITY_512M;
+       else if (para->density == 1024)
+               density = DRAM_DCR_CHIP_DENSITY_1024M;
+       else if (para->density == 2048)
+               density = DRAM_DCR_CHIP_DENSITY_2048M;
+       else if (para->density == 4096)
+               density = DRAM_DCR_CHIP_DENSITY_4096M;
+       else if (para->density == 8192)
+               density = DRAM_DCR_CHIP_DENSITY_8192M;
+       else
+               density = DRAM_DCR_CHIP_DENSITY_256M;
+
+       reg_val |= DRAM_DCR_CHIP_DENSITY(density);
+       reg_val |= DRAM_DCR_BUS_WIDTH((para->bus_width >> 3) - 1);
+       reg_val |= DRAM_DCR_RANK_SEL(para->rank_num - 1);
+       reg_val |= DRAM_DCR_CMD_RANK_ALL;
+       reg_val |= DRAM_DCR_MODE(DRAM_DCR_MODE_INTERLEAVE);
+       writel(reg_val, &dram->dcr);
+
+#ifdef CONFIG_SUN7I
+       setbits_le32(&dram->zqcr1, (0x1 << 24) | (0x1 << 1));
+       if (para->tpr4 & 0x2)
+               clrsetbits_le32(&dram->zqcr1, (0x1 << 24), (0x1 << 1));
+       dramc_clock_output_en(1);
+#endif
+
+#if (defined(CONFIG_SUN5I) || defined(CONFIG_SUN7I))
+       /* set odt impendance divide ratio */
+       reg_val = ((para->zq) >> 8) & 0xfffff;
+       reg_val |= ((para->zq) & 0xff) << 20;
+       reg_val |= (para->zq) & 0xf0000000;
+       writel(reg_val, &dram->zqcr0);
+#endif
+
+#ifdef CONFIG_SUN7I
+       /* Set CKE Delay to about 1ms */
+       setbits_le32(&dram->idcr, 0x1ffff);
+#endif
+
+#ifdef CONFIG_SUN7I
+       if ((readl(&dram->ppwrsctl) & 0x1) != 0x1)
+               mctl_ddr3_reset();
+       else
+               setbits_le32(&dram->mcr, DRAM_MCR_RESET);
+#endif
+
+       udelay(1);
+
+       await_completion(&dram->ccr, DRAM_CCR_INIT);
+
+       mctl_enable_dllx(para->tpr3);
+
+       /* set refresh period */
+       dramc_set_autorefresh_cycle(para->clock, para->type - 2, density);
+
+       /* set timing parameters */
+       writel(para->tpr0, &dram->tpr0);
+       writel(para->tpr1, &dram->tpr1);
+       writel(para->tpr2, &dram->tpr2);
+
+       if (para->type == DRAM_MEMORY_TYPE_DDR3) {
+               reg_val = DRAM_MR_BURST_LENGTH(0x0);
+#if (defined(CONFIG_SUN5I) || defined(CONFIG_SUN7I))
+               reg_val |= DRAM_MR_POWER_DOWN;
+#endif
+               reg_val |= DRAM_MR_CAS_LAT(para->cas - 4);
+               reg_val |= DRAM_MR_WRITE_RECOVERY(0x5);
+       } else if (para->type == DRAM_MEMORY_TYPE_DDR2) {
+               reg_val = DRAM_MR_BURST_LENGTH(0x2);
+               reg_val |= DRAM_MR_CAS_LAT(para->cas);
+               reg_val |= DRAM_MR_WRITE_RECOVERY(0x5);
+       }
+       writel(reg_val, &dram->mr);
+
+       writel(para->emr1, &dram->emr);
+       writel(para->emr2, &dram->emr2);
+       writel(para->emr3, &dram->emr3);
+
+       /* set DQS window mode */
+       clrsetbits_le32(&dram->ccr, DRAM_CCR_DQS_DRIFT_COMP, DRAM_CCR_DQS_GATE);
+
+#ifdef CONFIG_SUN7I
+       /* Command rate timing mode 2T & 1T */
+       if (para->tpr4 & 0x1)
+               setbits_le32(&dram->ccr, DRAM_CCR_COMMAND_RATE_1T);
+#endif
+       /* reset external DRAM */
+       setbits_le32(&dram->ccr, DRAM_CCR_INIT);
+       await_completion(&dram->ccr, DRAM_CCR_INIT);
+
+#ifdef CONFIG_SUN7I
+       /* setup zq calibration manual */
+       reg_val = readl(&dram->ppwrsctl);
+       if ((reg_val & 0x1) == 1) {
+               /* super_standby_flag = 1 */
+
+               reg_val = readl(0x01c20c00 + 0x120); /* rtc */
+               reg_val &= 0x000fffff;
+               reg_val |= 0x17b00000;
+               writel(reg_val, &dram->zqcr0);
+
+               /* exit self-refresh state */
+               clrsetbits_le32(&dram->dcr, 0x1f << 27, 0x12 << 27);
+               /* check whether command has been executed */
+               await_completion(&dram->dcr, 0x1 << 31);
+
+               udelay(2);
+
+               /* dram pad hold off */
+               setbits_le32(&dram->ppwrsctl, 0x16510000);
+
+               await_completion(&dram->ppwrsctl, 0x1);
+
+               /* exit self-refresh state */
+               clrsetbits_le32(&dram->dcr, 0x1f << 27, 0x12 << 27);
+
+               /* check whether command has been executed */
+               await_completion(&dram->dcr, 0x1 << 31);
+
+               udelay(2);
+
+               /* issue a refresh command */
+               clrsetbits_le32(&dram->dcr, 0x1f << 27, 0x13 << 27);
+               await_completion(&dram->dcr, 0x1 << 31);
+
+               udelay(2);
+       }
+#endif
+
+       /* scan read pipe value */
+       mctl_itm_enable();
+       if (para->tpr3 & (0x1 << 31)) {
+               ret_val = dramc_scan_dll_para();
+               if (ret_val == 0)
+                       para->tpr3 =
+                               (((readl(&dram->dllcr[0]) >> 6) & 0x3f) << 16) |
+                               (((readl(&dram->dllcr[1]) >> 14) & 0xf) << 0) |
+                               (((readl(&dram->dllcr[2]) >> 14) & 0xf) << 4) |
+                               (((readl(&dram->dllcr[3]) >> 14) & 0xf) << 8) |
+                               (((readl(&dram->dllcr[4]) >> 14) & 0xf) << 12
+                               );
+       } else {
+               ret_val = dramc_scan_readpipe();
+       }
+
+       if (ret_val < 0)
+               return 0;
+
+       /* configure all host port */
+       mctl_configure_hostport();
+
+       return get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE);
+}
diff --git a/arch/arm/cpu/armv7/sunxi/pinmux.c b/arch/arm/cpu/armv7/sunxi/pinmux.c
new file mode 100644 (file)
index 0000000..1f2843f
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/gpio.h>
+
+int sunxi_gpio_set_cfgpin(u32 pin, u32 val)
+{
+       u32 bank = GPIO_BANK(pin);
+       u32 index = GPIO_CFG_INDEX(pin);
+       u32 offset = GPIO_CFG_OFFSET(pin);
+       struct sunxi_gpio *pio = BANK_TO_GPIO(bank);
+
+       clrsetbits_le32(&pio->cfg[0] + index, 0xf << offset, val << offset);
+
+       return 0;
+}
+
+int sunxi_gpio_get_cfgpin(u32 pin)
+{
+       u32 cfg;
+       u32 bank = GPIO_BANK(pin);
+       u32 index = GPIO_CFG_INDEX(pin);
+       u32 offset = GPIO_CFG_OFFSET(pin);
+       struct sunxi_gpio *pio = BANK_TO_GPIO(bank);
+
+       cfg = readl(&pio->cfg[0] + index);
+       cfg >>= offset;
+
+       return cfg & 0xf;
+}
+
+int sunxi_gpio_set_drv(u32 pin, u32 val)
+{
+       u32 bank = GPIO_BANK(pin);
+       u32 index = GPIO_DRV_INDEX(pin);
+       u32 offset = GPIO_DRV_OFFSET(pin);
+       struct sunxi_gpio *pio = BANK_TO_GPIO(bank);
+
+       clrsetbits_le32(&pio->drv[0] + index, 0x3 << offset, val << offset);
+
+       return 0;
+}
+
+int sunxi_gpio_set_pull(u32 pin, u32 val)
+{
+       u32 bank = GPIO_BANK(pin);
+       u32 index = GPIO_PULL_INDEX(pin);
+       u32 offset = GPIO_PULL_OFFSET(pin);
+       struct sunxi_gpio *pio = BANK_TO_GPIO(bank);
+
+       clrsetbits_le32(&pio->pull[0] + index, 0x3 << offset, val << offset);
+
+       return 0;
+}
diff --git a/arch/arm/cpu/armv7/sunxi/start.c b/arch/arm/cpu/armv7/sunxi/start.c
new file mode 100644 (file)
index 0000000..6b392fa
--- /dev/null
@@ -0,0 +1 @@
+/* Intentionally empty. Only needed to get FEL SPL link line right */
diff --git a/arch/arm/cpu/armv7/sunxi/timer.c b/arch/arm/cpu/armv7/sunxi/timer.c
new file mode 100644 (file)
index 0000000..3626389
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/timer.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define TIMER_MODE   (0x0 << 7)        /* continuous mode */
+#define TIMER_DIV    (0x0 << 4)        /* pre scale 1 */
+#define TIMER_SRC    (0x1 << 2)        /* osc24m */
+#define TIMER_RELOAD (0x1 << 1)        /* reload internal value */
+#define TIMER_EN     (0x1 << 0)        /* enable timer */
+
+#define TIMER_CLOCK            (24 * 1000 * 1000)
+#define COUNT_TO_USEC(x)       ((x) / 24)
+#define USEC_TO_COUNT(x)       ((x) * 24)
+#define TICKS_PER_HZ           (TIMER_CLOCK / CONFIG_SYS_HZ)
+#define TICKS_TO_HZ(x)         ((x) / TICKS_PER_HZ)
+
+#define TIMER_LOAD_VAL         0xffffffff
+
+#define TIMER_NUM              0       /* we use timer 0 */
+
+/* read the 32-bit timer */
+static ulong read_timer(void)
+{
+       struct sunxi_timer_reg *timers =
+               (struct sunxi_timer_reg *)SUNXI_TIMER_BASE;
+       struct sunxi_timer *timer = &timers->timer[TIMER_NUM];
+
+       /*
+        * The hardware timer counts down, therefore we invert to
+        * produce an incrementing timer.
+        */
+       return ~readl(&timer->val);
+}
+
+/* init timer register */
+int timer_init(void)
+{
+       struct sunxi_timer_reg *timers =
+               (struct sunxi_timer_reg *)SUNXI_TIMER_BASE;
+       struct sunxi_timer *timer = &timers->timer[TIMER_NUM];
+       writel(TIMER_LOAD_VAL, &timer->inter);
+       writel(TIMER_MODE | TIMER_DIV | TIMER_SRC | TIMER_RELOAD | TIMER_EN,
+              &timer->ctl);
+
+       return 0;
+}
+
+/* timer without interrupts */
+ulong get_timer(ulong base)
+{
+       return get_timer_masked() - base;
+}
+
+ulong get_timer_masked(void)
+{
+       /* current tick value */
+       ulong now = TICKS_TO_HZ(read_timer());
+
+       if (now >= gd->arch.lastinc)    /* normal (non rollover) */
+               gd->arch.tbl += (now - gd->arch.lastinc);
+       else {
+               /* rollover */
+               gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL)
+                               - gd->arch.lastinc) + now;
+       }
+       gd->arch.lastinc = now;
+
+       return gd->arch.tbl;
+}
+
+/* delay x useconds */
+void __udelay(unsigned long usec)
+{
+       long tmo = USEC_TO_COUNT(usec);
+       ulong now, last = read_timer();
+
+       while (tmo > 0) {
+               now = read_timer();
+               if (now > last) /* normal (non rollover) */
+                       tmo -= now - last;
+               else            /* rollover */
+                       tmo -= TIMER_LOAD_VAL - last + now;
+               last = now;
+       }
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+       return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+       return CONFIG_SYS_HZ;
+}
diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds
new file mode 100644 (file)
index 0000000..364e35c
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * (C) Copyright 2013
+ * Henrik Nordstrom <henrik@henriknordstrom.net>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(s_init)
+SECTIONS
+{
+       . = 0x00002000;
+
+       . = ALIGN(4);
+       .text :
+       {
+               *(.text.s_init)
+               *(.text*)
+       }
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
+
+       . = ALIGN(4);
+       .data : {
+               *(.data*)
+       }
+
+       . = ALIGN(4);
+       . = .;
+
+       . = ALIGN(4);
+       .rel.dyn : {
+               __rel_dyn_start = .;
+               *(.rel*)
+               __rel_dyn_end = .;
+       }
+
+       .dynsym : {
+               __dynsym_start = .;
+               *(.dynsym)
+       }
+
+       . = ALIGN(4);
+       .note.gnu.build-id :
+       {
+               *(.note.gnu.build-id)
+       }
+       _end = .;
+
+       . = ALIGN(4096);
+       .mmutable : {
+               *(.mmutable)
+       }
+
+       .bss_start __rel_dyn_start (OVERLAY) : {
+               KEEP(*(.__bss_start));
+               __bss_base = .;
+       }
+
+       .bss __bss_base (OVERLAY) : {
+               *(.bss*)
+               . = ALIGN(4);
+               __bss_limit = .;
+       }
+
+       .bss_end __bss_limit (OVERLAY) : {
+               KEEP(*(.__bss_end));
+       }
+
+       /DISCARD/ : { *(.dynstr*) }
+       /DISCARD/ : { *(.dynamic*) }
+       /DISCARD/ : { *(.plt*) }
+       /DISCARD/ : { *(.interp*) }
+       /DISCARD/ : { *(.gnu*) }
+       /DISCARD/ : { *(.note*) }
+}
diff --git a/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds b/arch/arm/cpu/armv7/sunxi/u-boot-spl.lds
new file mode 100644 (file)
index 0000000..5008028
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * (C) Copyright 2012
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Based on omap-common/u-boot-spl.lds:
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *     Aneesh V <aneesh@ti.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
+               LENGTH = CONFIG_SPL_MAX_SIZE }
+MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
+               LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+       .text      :
+       {
+               __start = .;
+               arch/arm/cpu/armv7/start.o      (.text)
+               *(.text*)
+       } > .sram
+
+       . = ALIGN(4);
+       .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
+
+       . = ALIGN(4);
+       .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
+
+       . = ALIGN(4);
+       __image_copy_end = .;
+       _end = .;
+
+       .bss :
+       {
+               . = ALIGN(4);
+               __bss_start = .;
+               *(.bss*)
+               . = ALIGN(4);
+               __bss_end = .;
+       } > .sdram
+}
index 33d3f3688ae83bc45f13a79e12c84a0848d20d05..4b11aa4f22272cfa1766b0482ff8b1797e15db6e 100644 (file)
@@ -50,10 +50,10 @@ reset:
         */
        adr     x0, vectors
        switch_el x1, 3f, 2f, 1f
-3:     mrs     x0, scr_el3
+3:     msr     vbar_el3, x0
+       mrs     x0, scr_el3
        orr     x0, x0, #0xf                    /* SCR_EL3.NS|IRQ|FIQ|EA */
        msr     scr_el3, x0
-       msr     vbar_el3, x0
        msr     cptr_el3, xzr                   /* Enable FP/SIMD */
        ldr     x0, =COUNTER_FREQUENCY
        msr     cntfrq_el0, x0                  /* Initialize CNTFRQ */
index 7f4debb912597d5a251cfa095b0309497b2528b0..cbb5a529da2b520fb841e8cc77f2357606abeb3b 100644 (file)
@@ -20,6 +20,43 @@ static void at91_disable_wdt(void)
        writel(AT91_WDT_MR_WDDIS, &wdt->mr);
 }
 
+static void switch_to_main_crystal_osc(void)
+{
+       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+       u32 tmp;
+
+       tmp = readl(&pmc->mor);
+       tmp &= ~AT91_PMC_MOR_OSCOUNT(0xff);
+       tmp &= ~AT91_PMC_MOR_KEY(0xff);
+       tmp |= AT91_PMC_MOR_MOSCEN;
+       tmp |= AT91_PMC_MOR_OSCOUNT(8);
+       tmp |= AT91_PMC_MOR_KEY(0x37);
+       writel(tmp, &pmc->mor);
+       while (!(readl(&pmc->sr) & AT91_PMC_IXR_MOSCS))
+               ;
+
+       tmp = readl(&pmc->mor);
+       tmp &= ~AT91_PMC_MOR_OSCBYPASS;
+       tmp &= ~AT91_PMC_MOR_KEY(0xff);
+       tmp |= AT91_PMC_MOR_KEY(0x37);
+       writel(tmp, &pmc->mor);
+
+       tmp = readl(&pmc->mor);
+       tmp |= AT91_PMC_MOR_MOSCSEL;
+       tmp &= ~AT91_PMC_MOR_KEY(0xff);
+       tmp |= AT91_PMC_MOR_KEY(0x37);
+       writel(tmp, &pmc->mor);
+
+       while (!(readl(&pmc->sr) & AT91_PMC_IXR_MOSCSELS))
+               ;
+
+       tmp = readl(&pmc->mor);
+       tmp &= ~AT91_PMC_MOR_MOSCRCEN;
+       tmp &= ~AT91_PMC_MOR_KEY(0xff);
+       tmp |= AT91_PMC_MOR_KEY(0x37);
+       writel(tmp, &pmc->mor);
+}
+
 void at91_plla_init(u32 pllar)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
@@ -76,6 +113,8 @@ u32 spl_boot_mode(void)
 
 void s_init(void)
 {
+       switch_to_main_crystal_osc();
+
        /* disable watchdog */
        at91_disable_wdt();
 
index 4535608434c0b3de54e16596bc4c9e85b60ea7c9..04f6239fd0b846da6acd5e5227c861b517a8a72e 100644 (file)
@@ -70,7 +70,10 @@ typedef struct at91_pmc {
 
 #define AT91_PMC_MOR_MOSCEN            0x01
 #define AT91_PMC_MOR_OSCBYPASS         0x02
+#define AT91_PMC_MOR_MOSCRCEN          0x08
 #define AT91_PMC_MOR_OSCOUNT(x)                ((x & 0xff) << 8)
+#define AT91_PMC_MOR_KEY(x)            ((x & 0xff) << 16)
+#define AT91_PMC_MOR_MOSCSEL           (1 << 24)
 
 #define AT91_PMC_PLLXR_DIV(x)          (x & 0xFF)
 #define AT91_PMC_PLLXR_PLLCOUNT(x)     ((x & 0x3F) << 8)
@@ -142,6 +145,7 @@ typedef struct at91_pmc {
 #define AT91_PMC_IXR_PCKRDY1           0x00000200
 #define AT91_PMC_IXR_PCKRDY2           0x00000400
 #define AT91_PMC_IXR_PCKRDY3           0x00000800
+#define AT91_PMC_IXR_MOSCSELS          0x00010000
 
 #define                AT91_PMC_PCK            (1 <<  0)               /* Processor Clock */
 #define                AT91RM9200_PMC_UDP      (1 <<  1)               /* USB Devcice Port Clock [AT91RM9200 only] */
index a47103851e48594c1a19b64d4d1a1ef2303a1e89..d49c18480dca68ac56c9eec2aa83ba549e7ee002 100644 (file)
@@ -12,6 +12,9 @@
 #ifndef __AT91SAM9X5_H__
 #define __AT91SAM9X5_H__
 
+#define CONFIG_ARM926EJS       /* ARM926EJS Core */
+#define CONFIG_AT91FAMILY      /* it's a member of AT91 family */
+
 /*
  * Peripheral identifiers/interrupts.
  */
index a63f97406020753baf0efd7ee936b747d9446bdf..d712a0dc9136c47f52eed8cbed253114163a7952 100644 (file)
@@ -25,8 +25,6 @@
 # include <asm/arch/at91sam9x5.h>
 #elif defined(CONFIG_AT91CAP9)
 # include <asm/arch/at91cap9.h>
-#elif defined(CONFIG_AT91X40)
-# include <asm/arch/at91x40.h>
 #elif defined(CONFIG_SAMA5D3)
 # include <asm/arch/sama5d3.h>
 #else
diff --git a/arch/arm/include/asm/arch-sunxi/clock.h b/arch/arm/include/asm/arch-sunxi/clock.h
new file mode 100644 (file)
index 0000000..5669f39
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_CLOCK_H
+#define _SUNXI_CLOCK_H
+
+#include <linux/types.h>
+
+#define CLK_GATE_OPEN                  0x1
+#define CLK_GATE_CLOSE                 0x0
+
+/* clock control module regs definition */
+#include <asm/arch/clock_sun4i.h>
+
+#ifndef __ASSEMBLY__
+int clock_init(void);
+int clock_twi_onoff(int port, int state);
+void clock_set_pll1(unsigned int hz);
+unsigned int clock_get_pll6(void);
+void clock_init_safe(void);
+void clock_init_uart(void);
+#endif
+
+#endif /* _SUNXI_CLOCK_H */
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
new file mode 100644 (file)
index 0000000..928f3f2
--- /dev/null
@@ -0,0 +1,256 @@
+/*
+ * sun4i, sun5i and sun7i clock register definitions
+ *
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_CLOCK_SUN4I_H
+#define _SUNXI_CLOCK_SUN4I_H
+
+struct sunxi_ccm_reg {
+       u32 pll1_cfg;           /* 0x00 pll1 control */
+       u32 pll1_tun;           /* 0x04 pll1 tuning */
+       u32 pll2_cfg;           /* 0x08 pll2 control */
+       u32 pll2_tun;           /* 0x0c pll2 tuning */
+       u32 pll3_cfg;           /* 0x10 pll3 control */
+       u8 res0[0x4];
+       u32 pll4_cfg;           /* 0x18 pll4 control */
+       u8 res1[0x4];
+       u32 pll5_cfg;           /* 0x20 pll5 control */
+       u32 pll5_tun;           /* 0x24 pll5 tuning */
+       u32 pll6_cfg;           /* 0x28 pll6 control */
+       u32 pll6_tun;           /* 0x2c pll6 tuning */
+       u32 pll7_cfg;           /* 0x30 pll7 control */
+       u32 pll1_tun2;          /* 0x34 pll5 tuning2 */
+       u8 res2[0x4];
+       u32 pll5_tun2;          /* 0x3c pll5 tuning2 */
+       u8 res3[0xc];
+       u32 pll_lock_dbg;       /* 0x4c pll lock time debug */
+       u32 osc24m_cfg;         /* 0x50 osc24m control */
+       u32 cpu_ahb_apb0_cfg;   /* 0x54 cpu,ahb and apb0 divide ratio */
+       u32 apb1_clk_div_cfg;   /* 0x58 apb1 clock dividor */
+       u32 axi_gate;           /* 0x5c axi module clock gating */
+       u32 ahb_gate0;          /* 0x60 ahb module clock gating 0 */
+       u32 ahb_gate1;          /* 0x64 ahb module clock gating 1 */
+       u32 apb0_gate;          /* 0x68 apb0 module clock gating */
+       u32 apb1_gate;          /* 0x6c apb1 module clock gating */
+       u8 res4[0x10];
+       u32 nand_sclk_cfg;      /* 0x80 nand sub clock control */
+       u32 ms_sclk_cfg;        /* 0x84 memory stick sub clock control */
+       u32 sd0_clk_cfg;        /* 0x88 sd0 clock control */
+       u32 sd1_clk_cfg;        /* 0x8c sd1 clock control */
+       u32 sd2_clk_cfg;        /* 0x90 sd2 clock control */
+       u32 sd3_clk_cfg;        /* 0x94 sd3 clock control */
+       u32 ts_clk_cfg;         /* 0x98 transport stream clock control */
+       u32 ss_clk_cfg;         /* 0x9c */
+       u32 spi0_clk_cfg;       /* 0xa0 */
+       u32 spi1_clk_cfg;       /* 0xa4 */
+       u32 spi2_clk_cfg;       /* 0xa8 */
+       u32 pata_clk_cfg;       /* 0xac */
+       u32 ir0_clk_cfg;        /* 0xb0 */
+       u32 ir1_clk_cfg;        /* 0xb4 */
+       u32 iis_clk_cfg;        /* 0xb8 */
+       u32 ac97_clk_cfg;       /* 0xbc */
+       u32 spdif_clk_cfg;      /* 0xc0 */
+       u32 keypad_clk_cfg;     /* 0xc4 */
+       u32 sata_clk_cfg;       /* 0xc8 */
+       u32 usb_clk_cfg;        /* 0xcc */
+       u32 gps_clk_cfg;        /* 0xd0 */
+       u32 spi3_clk_cfg;       /* 0xd4 */
+       u8 res5[0x28];
+       u32 dram_clk_cfg;       /* 0x100 */
+       u32 be0_clk_cfg;        /* 0x104 */
+       u32 be1_clk_cfg;        /* 0x108 */
+       u32 fe0_clk_cfg;        /* 0x10c */
+       u32 fe1_clk_cfg;        /* 0x110 */
+       u32 mp_clk_cfg;         /* 0x114 */
+       u32 lcd0_ch0_clk_cfg;   /* 0x118 */
+       u32 lcd1_ch0_clk_cfg;   /* 0x11c */
+       u32 csi_isp_clk_cfg;    /* 0x120 */
+       u8 res6[0x4];
+       u32 tvd_clk_reg;        /* 0x128 */
+       u32 lcd0_ch1_clk_cfg;   /* 0x12c */
+       u32 lcd1_ch1_clk_cfg;   /* 0x130 */
+       u32 csi0_clk_cfg;       /* 0x134 */
+       u32 csi1_clk_cfg;       /* 0x138 */
+       u32 ve_clk_cfg;         /* 0x13c */
+       u32 audio_codec_clk_cfg;        /* 0x140 */
+       u32 avs_clk_cfg;        /* 0x144 */
+       u32 ace_clk_cfg;        /* 0x148 */
+       u32 lvds_clk_cfg;       /* 0x14c */
+       u32 hdmi_clk_cfg;       /* 0x150 */
+       u32 mali_clk_cfg;       /* 0x154 */
+       u8 res7[0x4];
+       u32 mbus_clk_cfg;       /* 0x15c */
+       u8 res8[0x4];
+       u32 gmac_clk_cfg;       /* 0x164 */
+};
+
+/* apb1 bit field */
+#define APB1_CLK_SRC_OSC24M            (0x0 << 24)
+#define APB1_CLK_SRC_PLL6              (0x1 << 24)
+#define APB1_CLK_SRC_LOSC              (0x2 << 24)
+#define APB1_CLK_SRC_MASK              (0x3 << 24)
+#define APB1_CLK_RATE_N_1              (0x0 << 16)
+#define APB1_CLK_RATE_N_2              (0x1 << 16)
+#define APB1_CLK_RATE_N_4              (0x2 << 16)
+#define APB1_CLK_RATE_N_8              (0x3 << 16)
+#define APB1_CLK_RATE_N_MASK           (3 << 16)
+#define APB1_CLK_RATE_M(m)             (((m)-1) << 0)
+#define APB1_CLK_RATE_M_MASK            (0x1f << 0)
+
+/* apb1 gate field */
+#define APB1_GATE_UART_SHIFT   (16)
+#define APB1_GATE_UART_MASK            (0xff << APB1_GATE_UART_SHIFT)
+#define APB1_GATE_TWI_SHIFT    (0)
+#define APB1_GATE_TWI_MASK             (0xf << APB1_GATE_TWI_SHIFT)
+
+/* clock divide */
+#define AXI_DIV_SHIFT          (0)
+#define AXI_DIV_1                      0
+#define AXI_DIV_2                      1
+#define AXI_DIV_3                      2
+#define AXI_DIV_4                      3
+#define AHB_DIV_SHIFT          (4)
+#define AHB_DIV_1                      0
+#define AHB_DIV_2                      1
+#define AHB_DIV_4                      2
+#define AHB_DIV_8                      3
+#define APB0_DIV_SHIFT         (8)
+#define APB0_DIV_1                     0
+#define APB0_DIV_2                     1
+#define APB0_DIV_4                     2
+#define APB0_DIV_8                     3
+#define CPU_CLK_SRC_SHIFT      (16)
+#define CPU_CLK_SRC_OSC24M             1
+#define CPU_CLK_SRC_PLL1               2
+
+#define CCM_PLL1_CFG_ENABLE_SHIFT              31
+#define CCM_PLL1_CFG_VCO_RST_SHIFT             30
+#define CCM_PLL1_CFG_VCO_BIAS_SHIFT            26
+#define CCM_PLL1_CFG_PLL4_EXCH_SHIFT           25
+#define CCM_PLL1_CFG_BIAS_CUR_SHIFT            20
+#define CCM_PLL1_CFG_DIVP_SHIFT                        16
+#define CCM_PLL1_CFG_LCK_TMR_SHIFT             13
+#define CCM_PLL1_CFG_FACTOR_N_SHIFT            8
+#define CCM_PLL1_CFG_FACTOR_K_SHIFT            4
+#define CCM_PLL1_CFG_SIG_DELT_PAT_IN_SHIFT     3
+#define CCM_PLL1_CFG_SIG_DELT_PAT_EN_SHIFT     2
+#define CCM_PLL1_CFG_FACTOR_M_SHIFT            0
+
+#define PLL1_CFG_DEFAULT       0xa1005000
+
+#define PLL6_CFG_DEFAULT       0xa1009911
+
+/* nand clock */
+#define NAND_CLK_SRC_OSC24             0
+#define NAND_CLK_DIV_N                 0
+#define NAND_CLK_DIV_M                 0
+
+/* gps clock */
+#define GPS_SCLK_GATING_OFF            0
+#define GPS_RESET                      0
+
+/* ahb clock gate bit offset */
+#define AHB_GATE_OFFSET_GPS            26
+#define AHB_GATE_OFFSET_SATA           25
+#define AHB_GATE_OFFSET_PATA           24
+#define AHB_GATE_OFFSET_SPI3           23
+#define AHB_GATE_OFFSET_SPI2           22
+#define AHB_GATE_OFFSET_SPI1           21
+#define AHB_GATE_OFFSET_SPI0           20
+#define AHB_GATE_OFFSET_TS0            18
+#define AHB_GATE_OFFSET_EMAC           17
+#define AHB_GATE_OFFSET_ACE            16
+#define AHB_GATE_OFFSET_DLL            15
+#define AHB_GATE_OFFSET_SDRAM          14
+#define AHB_GATE_OFFSET_NAND           13
+#define AHB_GATE_OFFSET_MS             12
+#define AHB_GATE_OFFSET_MMC3           11
+#define AHB_GATE_OFFSET_MMC2           10
+#define AHB_GATE_OFFSET_MMC1           9
+#define AHB_GATE_OFFSET_MMC0           8
+#define AHB_GATE_OFFSET_MMC(n)         (AHB_GATE_OFFSET_MMC0 + (n))
+#define AHB_GATE_OFFSET_BIST           7
+#define AHB_GATE_OFFSET_DMA            6
+#define AHB_GATE_OFFSET_SS             5
+#define AHB_GATE_OFFSET_USB_OHCI1      4
+#define AHB_GATE_OFFSET_USB_EHCI1      3
+#define AHB_GATE_OFFSET_USB_OHCI0      2
+#define AHB_GATE_OFFSET_USB_EHCI0      1
+#define AHB_GATE_OFFSET_USB            0
+
+/* ahb clock gate bit offset (second register) */
+#define AHB_GATE_OFFSET_GMAC           17
+
+#define CCM_AHB_GATE_GPS (0x1 << 26)
+#define CCM_AHB_GATE_SDRAM (0x1 << 14)
+#define CCM_AHB_GATE_DLL (0x1 << 15)
+#define CCM_AHB_GATE_ACE (0x1 << 16)
+
+#define CCM_PLL5_CTRL_M(n) (((n) & 0x3) << 0)
+#define CCM_PLL5_CTRL_M_MASK CCM_PLL5_CTRL_M(0x3)
+#define CCM_PLL5_CTRL_M_X(n) ((n) - 1)
+#define CCM_PLL5_CTRL_M1(n) (((n) & 0x3) << 2)
+#define CCM_PLL5_CTRL_M1_MASK CCM_PLL5_CTRL_M1(0x3)
+#define CCM_PLL5_CTRL_M1_X(n) ((n) - 1)
+#define CCM_PLL5_CTRL_K(n) (((n) & 0x3) << 4)
+#define CCM_PLL5_CTRL_K_MASK CCM_PLL5_CTRL_K(0x3)
+#define CCM_PLL5_CTRL_K_X(n) ((n) - 1)
+#define CCM_PLL5_CTRL_LDO (0x1 << 7)
+#define CCM_PLL5_CTRL_N(n) (((n) & 0x1f) << 8)
+#define CCM_PLL5_CTRL_N_MASK CCM_PLL5_CTRL_N(0x1f)
+#define CCM_PLL5_CTRL_N_X(n) (n)
+#define CCM_PLL5_CTRL_P(n) (((n) & 0x3) << 16)
+#define CCM_PLL5_CTRL_P_MASK CCM_PLL5_CTRL_P(0x3)
+#define CCM_PLL5_CTRL_P_X(n) ((n) - 1)
+#define CCM_PLL5_CTRL_BW (0x1 << 18)
+#define CCM_PLL5_CTRL_VCO_GAIN (0x1 << 19)
+#define CCM_PLL5_CTRL_BIAS(n) (((n) & 0x1f) << 20)
+#define CCM_PLL5_CTRL_BIAS_MASK CCM_PLL5_CTRL_BIAS(0x1f)
+#define CCM_PLL5_CTRL_BIAS_X(n) ((n) - 1)
+#define CCM_PLL5_CTRL_VCO_BIAS (0x1 << 25)
+#define CCM_PLL5_CTRL_DDR_CLK (0x1 << 29)
+#define CCM_PLL5_CTRL_BYPASS (0x1 << 30)
+#define CCM_PLL5_CTRL_EN (0x1 << 31)
+
+#define CCM_PLL6_CTRL_N_SHIFT  8
+#define CCM_PLL6_CTRL_N_MASK   (0x1f << CCM_PLL6_CTRL_N_SHIFT)
+#define CCM_PLL6_CTRL_K_SHIFT  4
+#define CCM_PLL6_CTRL_K_MASK   (0x3 << CCM_PLL6_CTRL_K_SHIFT)
+
+#define CCM_GPS_CTRL_RESET (0x1 << 0)
+#define CCM_GPS_CTRL_GATE (0x1 << 1)
+
+#define CCM_DRAM_CTRL_DCLK_OUT (0x1 << 15)
+
+#define CCM_MBUS_CTRL_M(n) (((n) & 0xf) << 0)
+#define CCM_MBUS_CTRL_M_MASK CCM_MBUS_CTRL_M(0xf)
+#define CCM_MBUS_CTRL_M_X(n) ((n) - 1)
+#define CCM_MBUS_CTRL_N(n) (((n) & 0xf) << 16)
+#define CCM_MBUS_CTRL_N_MASK CCM_MBUS_CTRL_N(0xf)
+#define CCM_MBUS_CTRL_N_X(n) (((n) >> 3) ? 3 : (((n) >> 2) ? 2 : (((n) >> 1) ? 1 : 0)))
+#define CCM_MBUS_CTRL_CLK_SRC(n) (((n) & 0x3) << 24)
+#define CCM_MBUS_CTRL_CLK_SRC_MASK CCM_MBUS_CTRL_CLK_SRC(0x3)
+#define CCM_MBUS_CTRL_CLK_SRC_HOSC 0x0
+#define CCM_MBUS_CTRL_CLK_SRC_PLL6 0x1
+#define CCM_MBUS_CTRL_CLK_SRC_PLL5 0x2
+#define CCM_MBUS_CTRL_GATE (0x1 << 31)
+
+#define CCM_MMC_CTRL_OSCM24 (0x0 << 24)
+#define CCM_MMC_CTRL_PLL6   (0x1 << 24)
+#define CCM_MMC_CTRL_PLL5   (0x2 << 24)
+
+#define CCM_MMC_CTRL_ENABLE (0x1 << 31)
+
+#define CCM_GMAC_CTRL_TX_CLK_SRC_MII 0x0
+#define CCM_GMAC_CTRL_TX_CLK_SRC_EXT_RGMII 0x1
+#define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
+#define CCM_GMAC_CTRL_GPIT_MII (0x0 << 2)
+#define CCM_GMAC_CTRL_GPIT_RGMII (0x1 << 2)
+
+#endif /* _SUNXI_CLOCK_SUN4I_H */
diff --git a/arch/arm/include/asm/arch-sunxi/cpu.h b/arch/arm/include/asm/arch-sunxi/cpu.h
new file mode 100644 (file)
index 0000000..a987e51
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_CPU_H
+#define _SUNXI_CPU_H
+
+#define SUNXI_SRAM_A1_BASE             0x00000000
+#define SUNXI_SRAM_A1_SIZE             (16 * 1024)     /* 16 kiB */
+
+#define SUNXI_SRAM_A2_BASE             0x00004000      /* 16 kiB */
+#define SUNXI_SRAM_A3_BASE             0x00008000      /* 13 kiB */
+#define SUNXI_SRAM_A4_BASE             0x0000b400      /* 3 kiB */
+#define SUNXI_SRAM_D_BASE              0x00010000      /* 4 kiB */
+#define SUNXI_SRAM_B_BASE              0x00020000      /* 64 kiB (secure) */
+
+#define SUNXI_SRAMC_BASE               0x01c00000
+#define SUNXI_DRAMC_BASE               0x01c01000
+#define SUNXI_DMA_BASE                 0x01c02000
+#define SUNXI_NFC_BASE                 0x01c03000
+#define SUNXI_TS_BASE                  0x01c04000
+#define SUNXI_SPI0_BASE                        0x01c05000
+#define SUNXI_SPI1_BASE                        0x01c06000
+#define SUNXI_MS_BASE                  0x01c07000
+#define SUNXI_TVD_BASE                 0x01c08000
+#define SUNXI_CSI0_BASE                        0x01c09000
+#define SUNXI_TVE0_BASE                        0x01c0a000
+#define SUNXI_EMAC_BASE                        0x01c0b000
+#define SUNXI_LCD0_BASE                        0x01c0C000
+#define SUNXI_LCD1_BASE                        0x01c0d000
+#define SUNXI_VE_BASE                  0x01c0e000
+#define SUNXI_MMC0_BASE                        0x01c0f000
+#define SUNXI_MMC1_BASE                        0x01c10000
+#define SUNXI_MMC2_BASE                        0x01c11000
+#define SUNXI_MMC3_BASE                        0x01c12000
+#define SUNXI_USB0_BASE                        0x01c13000
+#define SUNXI_USB1_BASE                        0x01c14000
+#define SUNXI_SS_BASE                  0x01c15000
+#define SUNXI_HDMI_BASE                        0x01c16000
+#define SUNXI_SPI2_BASE                        0x01c17000
+#define SUNXI_SATA_BASE                        0x01c18000
+#define SUNXI_PATA_BASE                        0x01c19000
+#define SUNXI_ACE_BASE                 0x01c1a000
+#define SUNXI_TVE1_BASE                        0x01c1b000
+#define SUNXI_USB2_BASE                        0x01c1c000
+#define SUNXI_CSI1_BASE                        0x01c1d000
+#define SUNXI_TZASC_BASE               0x01c1e000
+#define SUNXI_SPI3_BASE                        0x01c1f000
+
+#define SUNXI_CCM_BASE                 0x01c20000
+#define SUNXI_INTC_BASE                        0x01c20400
+#define SUNXI_PIO_BASE                 0x01c20800
+#define SUNXI_TIMER_BASE               0x01c20c00
+#define SUNXI_SPDIF_BASE               0x01c21000
+#define SUNXI_AC97_BASE                        0x01c21400
+#define SUNXI_IR0_BASE                 0x01c21800
+#define SUNXI_IR1_BASE                 0x01c21c00
+
+#define SUNXI_IIS_BASE                 0x01c22400
+#define SUNXI_LRADC_BASE               0x01c22800
+#define SUNXI_AD_DA_BASE               0x01c22c00
+#define SUNXI_KEYPAD_BASE              0x01c23000
+#define SUNXI_TZPC_BASE                        0x01c23400
+#define SUNXI_SID_BASE                 0x01c23800
+#define SUNXI_SJTAG_BASE               0x01c23c00
+
+#define SUNXI_TP_BASE                  0x01c25000
+#define SUNXI_PMU_BASE                 0x01c25400
+#define SUNXI_CPUCFG_BASE              0x01c25c00
+
+#define SUNXI_UART0_BASE               0x01c28000
+#define SUNXI_UART1_BASE               0x01c28400
+#define SUNXI_UART2_BASE               0x01c28800
+#define SUNXI_UART3_BASE               0x01c28c00
+#define SUNXI_UART4_BASE               0x01c29000
+#define SUNXI_UART5_BASE               0x01c29400
+#define SUNXI_UART6_BASE               0x01c29800
+#define SUNXI_UART7_BASE               0x01c29c00
+#define SUNXI_PS2_0_BASE               0x01c2a000
+#define SUNXI_PS2_1_BASE               0x01c2a400
+
+#define SUNXI_TWI0_BASE                        0x01c2ac00
+#define SUNXI_TWI1_BASE                        0x01c2b000
+#define SUNXI_TWI2_BASE                        0x01c2b400
+
+#define SUNXI_CAN_BASE                 0x01c2bc00
+
+#define SUNXI_SCR_BASE                 0x01c2c400
+
+#define SUNXI_GPS_BASE                 0x01c30000
+#define SUNXI_MALI400_BASE             0x01c40000
+#define SUNXI_GMAC_BASE                        0x01c50000
+
+/* module sram */
+#define SUNXI_SRAM_C_BASE              0x01d00000
+
+#define SUNXI_DE_FE0_BASE              0x01e00000
+#define SUNXI_DE_FE1_BASE              0x01e20000
+#define SUNXI_DE_BE0_BASE              0x01e60000
+#define SUNXI_DE_BE1_BASE              0x01e40000
+#define SUNXI_MP_BASE                  0x01e80000
+#define SUNXI_AVG_BASE                 0x01ea0000
+
+/* CoreSight Debug Module */
+#define SUNXI_CSDM_BASE                        0x3f500000
+
+#define SUNXI_DDRII_DDRIII_BASE                0x40000000      /* 2 GiB */
+
+#define SUNXI_BROM_BASE                        0xffff0000      /* 32 kiB */
+
+#define SUNXI_CPU_CFG                  (SUNXI_TIMER_BASE + 0x13c)
+
+#ifndef __ASSEMBLY__
+void sunxi_board_init(void);
+void sunxi_reset(void);
+#endif /* __ASSEMBLY__ */
+
+#endif /* _CPU_H */
diff --git a/arch/arm/include/asm/arch-sunxi/dram.h b/arch/arm/include/asm/arch-sunxi/dram.h
new file mode 100644 (file)
index 0000000..67fbfad
--- /dev/null
@@ -0,0 +1,179 @@
+/*
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Berg Xing <bergxing@allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Sunxi platform dram register definition.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_DRAM_H
+#define _SUNXI_DRAM_H
+
+#include <linux/types.h>
+
+struct sunxi_dram_reg {
+       u32 ccr;                /* 0x00 controller configuration register */
+       u32 dcr;                /* 0x04 dram configuration register */
+       u32 iocr;               /* 0x08 i/o configuration register */
+       u32 csr;                /* 0x0c controller status register */
+       u32 drr;                /* 0x10 dram refresh register */
+       u32 tpr0;               /* 0x14 dram timing parameters register 0 */
+       u32 tpr1;               /* 0x18 dram timing parameters register 1 */
+       u32 tpr2;               /* 0x1c dram timing parameters register 2 */
+       u32 gdllcr;             /* 0x20 global dll control register */
+       u8 res0[0x28];
+       u32 rslr0;              /* 0x4c rank system latency register */
+       u32 rslr1;              /* 0x50 rank system latency register */
+       u8 res1[0x8];
+       u32 rdgr0;              /* 0x5c rank dqs gating register */
+       u32 rdgr1;              /* 0x60 rank dqs gating register */
+       u8 res2[0x34];
+       u32 odtcr;              /* 0x98 odt configuration register */
+       u32 dtr0;               /* 0x9c data training register 0 */
+       u32 dtr1;               /* 0xa0 data training register 1 */
+       u32 dtar;               /* 0xa4 data training address register */
+       u32 zqcr0;              /* 0xa8 zq control register 0 */
+       u32 zqcr1;              /* 0xac zq control register 1 */
+       u32 zqsr;               /* 0xb0 zq status register */
+       u32 idcr;               /* 0xb4 initializaton delay configure reg */
+       u8 res3[0x138];
+       u32 mr;                 /* 0x1f0 mode register */
+       u32 emr;                /* 0x1f4 extended mode register */
+       u32 emr2;               /* 0x1f8 extended mode register */
+       u32 emr3;               /* 0x1fc extended mode register */
+       u32 dllctr;             /* 0x200 dll control register */
+       u32 dllcr[5];           /* 0x204 dll control register 0(byte 0) */
+       /* 0x208 dll control register 1(byte 1) */
+       /* 0x20c dll control register 2(byte 2) */
+       /* 0x210 dll control register 3(byte 3) */
+       /* 0x214 dll control register 4(byte 4) */
+       u32 dqtr0;              /* 0x218 dq timing register */
+       u32 dqtr1;              /* 0x21c dq timing register */
+       u32 dqtr2;              /* 0x220 dq timing register */
+       u32 dqtr3;              /* 0x224 dq timing register */
+       u32 dqstr;              /* 0x228 dqs timing register */
+       u32 dqsbtr;             /* 0x22c dqsb timing register */
+       u32 mcr;                /* 0x230 mode configure register */
+       u8 res[0x8];
+       u32 ppwrsctl;           /* 0x23c pad power save control */
+       u32 apr;                /* 0x240 arbiter period register */
+       u32 pldtr;              /* 0x244 priority level data threshold reg */
+       u8 res5[0x8];
+       u32 hpcr[32];           /* 0x250 host port configure register */
+       u8 res6[0x10];
+       u32 csel;               /* 0x2e0 controller select register */
+};
+
+struct dram_para {
+       u32 clock;
+       u32 type;
+       u32 rank_num;
+       u32 density;
+       u32 io_width;
+       u32 bus_width;
+       u32 cas;
+       u32 zq;
+       u32 odt_en;
+       u32 size;
+       u32 tpr0;
+       u32 tpr1;
+       u32 tpr2;
+       u32 tpr3;
+       u32 tpr4;
+       u32 tpr5;
+       u32 emr1;
+       u32 emr2;
+       u32 emr3;
+};
+
+#define DRAM_CCR_COMMAND_RATE_1T (0x1 << 5)
+#define DRAM_CCR_DQS_GATE (0x1 << 14)
+#define DRAM_CCR_DQS_DRIFT_COMP (0x1 << 17)
+#define DRAM_CCR_ITM_OFF (0x1 << 28)
+#define DRAM_CCR_DATA_TRAINING (0x1 << 30)
+#define DRAM_CCR_INIT (0x1 << 31)
+
+#define DRAM_MEMORY_TYPE_DDR1 1
+#define DRAM_MEMORY_TYPE_DDR2 2
+#define DRAM_MEMORY_TYPE_DDR3 3
+#define DRAM_MEMORY_TYPE_LPDDR2 4
+#define DRAM_MEMORY_TYPE_LPDDR 5
+#define DRAM_DCR_TYPE (0x1 << 0)
+#define DRAM_DCR_TYPE_DDR2 0x0
+#define DRAM_DCR_TYPE_DDR3 0x1
+#define DRAM_DCR_IO_WIDTH(n) (((n) & 0x3) << 1)
+#define DRAM_DCR_IO_WIDTH_MASK DRAM_DCR_IO_WIDTH(0x3)
+#define DRAM_DCR_IO_WIDTH_8BIT 0x0
+#define DRAM_DCR_IO_WIDTH_16BIT 0x1
+#define DRAM_DCR_CHIP_DENSITY(n) (((n) & 0x7) << 3)
+#define DRAM_DCR_CHIP_DENSITY_MASK DRAM_DCR_CHIP_DENSITY(0x7)
+#define DRAM_DCR_CHIP_DENSITY_256M 0x0
+#define DRAM_DCR_CHIP_DENSITY_512M 0x1
+#define DRAM_DCR_CHIP_DENSITY_1024M 0x2
+#define DRAM_DCR_CHIP_DENSITY_2048M 0x3
+#define DRAM_DCR_CHIP_DENSITY_4096M 0x4
+#define DRAM_DCR_CHIP_DENSITY_8192M 0x5
+#define DRAM_DCR_BUS_WIDTH(n) (((n) & 0x7) << 6)
+#define DRAM_DCR_BUS_WIDTH_MASK DRAM_DCR_BUS_WIDTH(0x7)
+#define DRAM_DCR_BUS_WIDTH_32BIT 0x3
+#define DRAM_DCR_BUS_WIDTH_16BIT 0x1
+#define DRAM_DCR_BUS_WIDTH_8BIT 0x0
+#define DRAM_DCR_NR_DLLCR_32BIT 5
+#define DRAM_DCR_NR_DLLCR_16BIT 3
+#define DRAM_DCR_NR_DLLCR_8BIT 2
+#define DRAM_DCR_RANK_SEL(n) (((n) & 0x3) << 10)
+#define DRAM_DCR_RANK_SEL_MASK DRAM_DCR_CMD_RANK(0x3)
+#define DRAM_DCR_CMD_RANK_ALL (0x1 << 12)
+#define DRAM_DCR_MODE(n) (((n) & 0x3) << 13)
+#define DRAM_DCR_MODE_MASK DRAM_DCR_MODE(0x3)
+#define DRAM_DCR_MODE_SEQ 0x0
+#define DRAM_DCR_MODE_INTERLEAVE 0x1
+
+#define DRAM_CSR_FAILED (0x1 << 20)
+
+#define DRAM_DRR_TRFC(n) ((n) & 0xff)
+#define DRAM_DRR_TREFI(n) (((n) & 0xffff) << 8)
+#define DRAM_DRR_BURST(n) ((((n) - 1) & 0xf) << 24)
+
+#define DRAM_MCR_MODE_NORM(n) (((n) & 0x3) << 0)
+#define DRAM_MCR_MODE_NORM_MASK DRAM_MCR_MOD_NORM(0x3)
+#define DRAM_MCR_MODE_DQ_OUT(n) (((n) & 0x3) << 2)
+#define DRAM_MCR_MODE_DQ_OUT_MASK DRAM_MCR_MODE_DQ_OUT(0x3)
+#define DRAM_MCR_MODE_ADDR_OUT(n) (((n) & 0x3) << 4)
+#define DRAM_MCR_MODE_ADDR_OUT_MASK DRAM_MCR_MODE_ADDR_OUT(0x3)
+#define DRAM_MCR_MODE_DQ_IN_OUT(n) (((n) & 0x3) << 6)
+#define DRAM_MCR_MODE_DQ_IN_OUT_MASK DRAM_MCR_MODE_DQ_IN_OUT(0x3)
+#define DRAM_MCR_MODE_DQ_TURNON_DELAY(n) (((n) & 0x7) << 8)
+#define DRAM_MCR_MODE_DQ_TURNON_DELAY_MASK DRAM_MCR_MODE_DQ_TURNON_DELAY(0x7)
+#define DRAM_MCR_MODE_ADDR_IN (0x1 << 11)
+#define DRAM_MCR_RESET (0x1 << 12)
+#define DRAM_MCR_MODE_EN(n) (((n) & 0x3) << 13)
+#define DRAM_MCR_MODE_EN_MASK DRAM_MCR_MOD_EN(0x3)
+#define DRAM_MCR_DCLK_OUT (0x1 << 16)
+
+#define DRAM_DLLCR_NRESET (0x1 << 30)
+#define DRAM_DLLCR_DISABLE (0x1 << 31)
+
+#define DRAM_ZQCR0_IMP_DIV(n) (((n) & 0xff) << 20)
+#define DRAM_ZQCR0_IMP_DIV_MASK DRAM_ZQCR0_IMP_DIV(0xff)
+
+#define DRAM_IOCR_ODT_EN(n) ((((n) & 0x3) << 30) | ((n) & 0x3) << 0)
+#define DRAM_IOCR_ODT_EN_MASK DRAM_IOCR_ODT_EN(0x3)
+
+#define DRAM_MR_BURST_LENGTH(n) (((n) & 0x7) << 0)
+#define DRAM_MR_BURST_LENGTH_MASK DRAM_MR_BURST_LENGTH(0x7)
+#define DRAM_MR_CAS_LAT(n) (((n) & 0x7) << 4)
+#define DRAM_MR_CAS_LAT_MASK DRAM_MR_CAS_LAT(0x7)
+#define DRAM_MR_WRITE_RECOVERY(n) (((n) & 0x7) << 9)
+#define DRAM_MR_WRITE_RECOVERY_MASK DRAM_MR_WRITE_RECOVERY(0x7)
+#define DRAM_MR_POWER_DOWN (0x1 << 12)
+
+#define DRAM_CSEL_MAGIC 0x16237495
+
+unsigned long sunxi_dram_init(void);
+unsigned long dramc_init(struct dram_para *para);
+
+#endif /* _SUNXI_DRAM_H */
diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h b/arch/arm/include/asm/arch-sunxi/gpio.h
new file mode 100644 (file)
index 0000000..892479c
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_GPIO_H
+#define _SUNXI_GPIO_H
+
+#include <linux/types.h>
+
+/*
+ * sunxi has 9 banks of gpio, they are:
+ * PA0 - PA17 | PB0 - PB23 | PC0 - PC24
+ * PD0 - PD27 | PE0 - PE31 | PF0 - PF5
+ * PG0 - PG9  | PH0 - PH27 | PI0 - PI12
+ */
+
+#define SUNXI_GPIO_A   0
+#define SUNXI_GPIO_B   1
+#define SUNXI_GPIO_C   2
+#define SUNXI_GPIO_D   3
+#define SUNXI_GPIO_E   4
+#define SUNXI_GPIO_F   5
+#define SUNXI_GPIO_G   6
+#define SUNXI_GPIO_H   7
+#define SUNXI_GPIO_I   8
+#define SUNXI_GPIO_BANKS 9
+
+struct sunxi_gpio {
+       u32 cfg[4];
+       u32 dat;
+       u32 drv[2];
+       u32 pull[2];
+};
+
+/* gpio interrupt control */
+struct sunxi_gpio_int {
+       u32 cfg[3];
+       u32 ctl;
+       u32 sta;
+       u32 deb;                /* interrupt debounce */
+};
+
+struct sunxi_gpio_reg {
+       struct sunxi_gpio gpio_bank[SUNXI_GPIO_BANKS];
+       u8 res[0xbc];
+       struct sunxi_gpio_int gpio_int;
+};
+
+#define BANK_TO_GPIO(bank) \
+       &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank]
+
+#define GPIO_BANK(pin)         ((pin) >> 5)
+#define GPIO_NUM(pin)          ((pin) & 0x1f)
+
+#define GPIO_CFG_INDEX(pin)    (((pin) & 0x1f) >> 3)
+#define GPIO_CFG_OFFSET(pin)   ((((pin) & 0x1f) & 0x7) << 2)
+
+#define GPIO_DRV_INDEX(pin)   (((pin) & 0x1f) >> 4)
+#define GPIO_DRV_OFFSET(pin)   ((((pin) & 0x1f) & 0xf) << 1)
+
+#define GPIO_PULL_INDEX(pin)   (((pin) & 0x1f) >> 4)
+#define GPIO_PULL_OFFSET(pin)  ((((pin) & 0x1f) & 0xf) << 1)
+
+/* GPIO bank sizes */
+#define SUNXI_GPIO_A_NR                32
+#define SUNXI_GPIO_B_NR                32
+#define SUNXI_GPIO_C_NR                32
+#define SUNXI_GPIO_D_NR                32
+#define SUNXI_GPIO_E_NR                32
+#define SUNXI_GPIO_F_NR                32
+#define SUNXI_GPIO_G_NR                32
+#define SUNXI_GPIO_H_NR                32
+#define SUNXI_GPIO_I_NR                32
+
+#define SUNXI_GPIO_NEXT(__gpio) \
+       ((__gpio##_START) + (__gpio##_NR) + 0)
+
+enum sunxi_gpio_number {
+       SUNXI_GPIO_A_START = 0,
+       SUNXI_GPIO_B_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_A),
+       SUNXI_GPIO_C_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_B),
+       SUNXI_GPIO_D_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_C),
+       SUNXI_GPIO_E_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_D),
+       SUNXI_GPIO_F_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_E),
+       SUNXI_GPIO_G_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_F),
+       SUNXI_GPIO_H_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_G),
+       SUNXI_GPIO_I_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_H),
+};
+
+/* SUNXI GPIO number definitions */
+#define SUNXI_GPA(_nr) (SUNXI_GPIO_A_START + (_nr))
+#define SUNXI_GPB(_nr) (SUNXI_GPIO_B_START + (_nr))
+#define SUNXI_GPC(_nr) (SUNXI_GPIO_C_START + (_nr))
+#define SUNXI_GPD(_nr) (SUNXI_GPIO_D_START + (_nr))
+#define SUNXI_GPE(_nr) (SUNXI_GPIO_E_START + (_nr))
+#define SUNXI_GPF(_nr) (SUNXI_GPIO_F_START + (_nr))
+#define SUNXI_GPG(_nr) (SUNXI_GPIO_G_START + (_nr))
+#define SUNXI_GPH(_nr) (SUNXI_GPIO_H_START + (_nr))
+#define SUNXI_GPI(_nr) (SUNXI_GPIO_I_START + (_nr))
+
+/* GPIO pin function config */
+#define SUNXI_GPIO_INPUT       0
+#define SUNXI_GPIO_OUTPUT      1
+
+#define SUNXI_GPA0_EMAC                2
+#define SUN7I_GPA0_GMAC                5
+
+#define SUNXI_GPB0_TWI0                2
+
+#define SUN4I_GPB22_UART0_TX   2
+#define SUN4I_GPB23_UART0_RX   2
+
+#define SUN5I_GPB19_UART0_TX   2
+#define SUN5I_GPB20_UART0_RX   2
+
+#define SUN5I_GPG3_UART1_TX    4
+#define SUN5I_GPG4_UART1_RX    4
+
+#define SUNXI_GPC6_SDC2                3
+
+#define SUNXI_GPF0_SDC0                2
+
+#define SUNXI_GPF2_SDC0                2
+#define SUNXI_GPF2_UART0_TX    4
+#define SUNXI_GPF4_UART0_RX    4
+
+#define SUN4I_GPG0_SDC1                4
+
+#define SUN4I_GPH22_SDC1       5
+
+#define SUN4I_GPI4_SDC3                2
+
+/* GPIO pin pull-up/down config */
+#define SUNXI_GPIO_PULL_DISABLE        0
+#define SUNXI_GPIO_PULL_UP     1
+#define SUNXI_GPIO_PULL_DOWN   2
+
+int sunxi_gpio_set_cfgpin(u32 pin, u32 val);
+int sunxi_gpio_get_cfgpin(u32 pin);
+int sunxi_gpio_set_drv(u32 pin, u32 val);
+int sunxi_gpio_set_pull(u32 pin, u32 val);
+
+#endif /* _SUNXI_GPIO_H */
diff --git a/arch/arm/include/asm/arch-sunxi/mmc.h b/arch/arm/include/asm/arch-sunxi/mmc.h
new file mode 100644 (file)
index 0000000..53196e3
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Aaron <leafy.myeh@allwinnertech.com>
+ *
+ * MMC register definition for allwinner sunxi platform.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_MMC_H
+#define _SUNXI_MMC_H
+
+#include <linux/types.h>
+
+struct sunxi_mmc {
+       u32 gctrl;              /* 0x00 global control */
+       u32 clkcr;              /* 0x04 clock control */
+       u32 timeout;            /* 0x08 time out */
+       u32 width;              /* 0x0c bus width */
+       u32 blksz;              /* 0x10 block size */
+       u32 bytecnt;            /* 0x14 byte count */
+       u32 cmd;                /* 0x18 command */
+       u32 arg;                /* 0x1c argument */
+       u32 resp0;              /* 0x20 response 0 */
+       u32 resp1;              /* 0x24 response 1 */
+       u32 resp2;              /* 0x28 response 2 */
+       u32 resp3;              /* 0x2c response 3 */
+       u32 imask;              /* 0x30 interrupt mask */
+       u32 mint;               /* 0x34 masked interrupt status */
+       u32 rint;               /* 0x38 raw interrupt status */
+       u32 status;             /* 0x3c status */
+       u32 ftrglevel;          /* 0x40 FIFO threshold watermark*/
+       u32 funcsel;            /* 0x44 function select */
+       u32 cbcr;               /* 0x48 CIU byte count */
+       u32 bbcr;               /* 0x4c BIU byte count */
+       u32 dbgc;               /* 0x50 debug enable */
+       u32 res0[11];
+       u32 dmac;               /* 0x80 internal DMA control */
+       u32 dlba;               /* 0x84 internal DMA descr list base address */
+       u32 idst;               /* 0x88 internal DMA status */
+       u32 idie;               /* 0x8c internal DMA interrupt enable */
+       u32 chda;               /* 0x90 */
+       u32 cbda;               /* 0x94 */
+       u32 res1[26];
+       u32 fifo;               /* 0x100 FIFO access address */
+};
+
+#define SUNXI_MMC_CLK_POWERSAVE                (0x1 << 17)
+#define SUNXI_MMC_CLK_ENABLE           (0x1 << 16)
+#define SUNXI_MMC_CLK_DIVIDER_MASK     (0xff)
+
+#define SUNXI_MMC_GCTRL_SOFT_RESET     (0x1 << 0)
+#define SUNXI_MMC_GCTRL_FIFO_RESET     (0x1 << 1)
+#define SUNXI_MMC_GCTRL_DMA_RESET      (0x1 << 2)
+#define SUNXI_MMC_GCTRL_RESET          (SUNXI_MMC_GCTRL_SOFT_RESET|\
+                                        SUNXI_MMC_GCTRL_FIFO_RESET|\
+                                        SUNXI_MMC_GCTRL_DMA_RESET)
+#define SUNXI_MMC_GCTRL_DMA_ENABLE     (0x1 << 5)
+#define SUNXI_MMC_GCTRL_ACCESS_BY_AHB   (0x1 << 31)
+
+#define SUNXI_MMC_CMD_RESP_EXPIRE      (0x1 << 6)
+#define SUNXI_MMC_CMD_LONG_RESPONSE    (0x1 << 7)
+#define SUNXI_MMC_CMD_CHK_RESPONSE_CRC (0x1 << 8)
+#define SUNXI_MMC_CMD_DATA_EXPIRE      (0x1 << 9)
+#define SUNXI_MMC_CMD_WRITE            (0x1 << 10)
+#define SUNXI_MMC_CMD_AUTO_STOP                (0x1 << 12)
+#define SUNXI_MMC_CMD_WAIT_PRE_OVER    (0x1 << 13)
+#define SUNXI_MMC_CMD_SEND_INIT_SEQ    (0x1 << 15)
+#define SUNXI_MMC_CMD_UPCLK_ONLY       (0x1 << 21)
+#define SUNXI_MMC_CMD_START            (0x1 << 31)
+
+#define SUNXI_MMC_RINT_RESP_ERROR              (0x1 << 1)
+#define SUNXI_MMC_RINT_COMMAND_DONE            (0x1 << 2)
+#define SUNXI_MMC_RINT_DATA_OVER               (0x1 << 3)
+#define SUNXI_MMC_RINT_TX_DATA_REQUEST         (0x1 << 4)
+#define SUNXI_MMC_RINT_RX_DATA_REQUEST         (0x1 << 5)
+#define SUNXI_MMC_RINT_RESP_CRC_ERROR          (0x1 << 6)
+#define SUNXI_MMC_RINT_DATA_CRC_ERROR          (0x1 << 7)
+#define SUNXI_MMC_RINT_RESP_TIMEOUT            (0x1 << 8)
+#define SUNXI_MMC_RINT_DATA_TIMEOUT            (0x1 << 9)
+#define SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE     (0x1 << 10)
+#define SUNXI_MMC_RINT_FIFO_RUN_ERROR          (0x1 << 11)
+#define SUNXI_MMC_RINT_HARD_WARE_LOCKED                (0x1 << 12)
+#define SUNXI_MMC_RINT_START_BIT_ERROR         (0x1 << 13)
+#define SUNXI_MMC_RINT_AUTO_COMMAND_DONE       (0x1 << 14)
+#define SUNXI_MMC_RINT_END_BIT_ERROR           (0x1 << 15)
+#define SUNXI_MMC_RINT_SDIO_INTERRUPT          (0x1 << 16)
+#define SUNXI_MMC_RINT_CARD_INSERT             (0x1 << 30)
+#define SUNXI_MMC_RINT_CARD_REMOVE             (0x1 << 31)
+#define SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT      \
+       (SUNXI_MMC_RINT_RESP_ERROR |            \
+        SUNXI_MMC_RINT_RESP_CRC_ERROR |        \
+        SUNXI_MMC_RINT_DATA_CRC_ERROR |        \
+        SUNXI_MMC_RINT_RESP_TIMEOUT |          \
+        SUNXI_MMC_RINT_DATA_TIMEOUT |          \
+        SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE |   \
+        SUNXI_MMC_RINT_FIFO_RUN_ERROR |        \
+        SUNXI_MMC_RINT_HARD_WARE_LOCKED |      \
+        SUNXI_MMC_RINT_START_BIT_ERROR |       \
+        SUNXI_MMC_RINT_END_BIT_ERROR) /* 0xbfc2 */
+#define SUNXI_MMC_RINT_INTERRUPT_DONE_BIT      \
+       (SUNXI_MMC_RINT_AUTO_COMMAND_DONE |     \
+        SUNXI_MMC_RINT_DATA_OVER |             \
+        SUNXI_MMC_RINT_COMMAND_DONE |          \
+        SUNXI_MMC_RINT_VOLTAGE_CHANGE_DONE)
+
+#define SUNXI_MMC_STATUS_RXWL_FLAG             (0x1 << 0)
+#define SUNXI_MMC_STATUS_TXWL_FLAG             (0x1 << 1)
+#define SUNXI_MMC_STATUS_FIFO_EMPTY            (0x1 << 2)
+#define SUNXI_MMC_STATUS_FIFO_FULL             (0x1 << 3)
+#define SUNXI_MMC_STATUS_CARD_PRESENT          (0x1 << 8)
+#define SUNXI_MMC_STATUS_CARD_DATA_BUSY                (0x1 << 9)
+#define SUNXI_MMC_STATUS_DATA_FSM_BUSY         (0x1 << 10)
+
+#define SUNXI_MMC_IDMAC_RESET          (0x1 << 0)
+#define SUNXI_MMC_IDMAC_FIXBURST       (0x1 << 1)
+#define SUNXI_MMC_IDMAC_ENABLE         (0x1 << 7)
+
+#define SUNXI_MMC_IDIE_TXIRQ           (0x1 << 0)
+#define SUNXI_MMC_IDIE_RXIRQ           (0x1 << 1)
+
+int sunxi_mmc_init(int sdc_no);
+#endif /* _SUNXI_MMC_H */
diff --git a/arch/arm/include/asm/arch-sunxi/spl.h b/arch/arm/include/asm/arch-sunxi/spl.h
new file mode 100644 (file)
index 0000000..ff871bc
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * This is a copy of omap3/spl.h:
+ *
+ * (C) Copyright 2012
+ * Texas Instruments, <www.ti.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+#ifndef        _ASM_ARCH_SPL_H_
+#define        _ASM_SPL_H_
+
+#define BOOT_DEVICE_NONE       0
+#define BOOT_DEVICE_XIP                1
+#define BOOT_DEVICE_NAND       2
+#define BOOT_DEVICE_ONE_NAND   3
+#define BOOT_DEVICE_MMC2       5 /*emmc*/
+#define BOOT_DEVICE_MMC1       6
+#define BOOT_DEVICE_XIPWAIT    7
+#define BOOT_DEVICE_MMC2_2      0xff
+#endif
diff --git a/arch/arm/include/asm/arch-sunxi/sys_proto.h b/arch/arm/include/asm/arch-sunxi/sys_proto.h
new file mode 100644 (file)
index 0000000..c3e636e
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * (C) Copyright 2007-2012
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SYS_PROTO_H_
+#define _SYS_PROTO_H_
+
+#include <linux/types.h>
+
+void sdelay(unsigned long);
+
+#endif
diff --git a/arch/arm/include/asm/arch-sunxi/timer.h b/arch/arm/include/asm/arch-sunxi/timer.h
new file mode 100644 (file)
index 0000000..6aacfd7
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Configuration settings for the Allwinner A10-evb board.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_TIMER_H_
+#define _SUNXI_TIMER_H_
+
+#ifndef __ASSEMBLY__
+
+#include <linux/types.h>
+
+/* General purpose timer */
+struct sunxi_timer {
+       u32 ctl;
+       u32 inter;
+       u32 val;
+       u8 res[4];
+};
+
+/* Audio video sync*/
+struct sunxi_avs {
+       u32 ctl;                /* 0x80 */
+       u32 cnt0;               /* 0x84 */
+       u32 cnt1;               /* 0x88 */
+       u32 div;                /* 0x8c */
+};
+
+/* 64 bit counter */
+struct sunxi_64cnt {
+       u32 ctl;                /* 0xa0 */
+       u32 lo;                 /* 0xa4 */
+       u32 hi;                 /* 0xa8 */
+};
+
+/* Watchdog */
+struct sunxi_wdog {
+       u32 ctl;                /* 0x90 */
+       u32 mode;               /* 0x94 */
+};
+
+/* Rtc */
+struct sunxi_rtc {
+       u32 ctl;                /* 0x100 */
+       u32 yymmdd;             /* 0x104 */
+       u32 hhmmss;             /* 0x108 */
+};
+
+/* Alarm */
+struct sunxi_alarm {
+       u32 ddhhmmss;           /* 0x10c */
+       u32 hhmmss;             /* 0x110 */
+       u32 en;                 /* 0x114 */
+       u32 irqen;              /* 0x118 */
+       u32 irqsta;             /* 0x11c */
+};
+
+/* Timer general purpose register */
+struct sunxi_tgp {
+       u32 tgpd;
+};
+
+struct sunxi_timer_reg {
+       u32 tirqen;             /* 0x00 */
+       u32 tirqsta;            /* 0x04 */
+       u8 res1[8];
+       struct sunxi_timer timer[6];    /* We have 6 timers */
+       u8 res2[16];
+       struct sunxi_avs avs;
+       struct sunxi_wdog wdog;
+       u8 res3[8];
+       struct sunxi_64cnt cnt64;
+       u8 res4[0x58];
+       struct sunxi_rtc rtc;
+       struct sunxi_alarm alarm;
+       struct sunxi_tgp tgp[4];
+       u8 res5[8];
+       u32 cpu_cfg;
+};
+
+#endif /* __ASSEMBLY__ */
+
+#endif
index c2f976184664872567f7f8f019a7f43ccb1ccc11..0c28e1b8403a4f52a89c1e26117ea5a558323b23 100644 (file)
 #define DDRMC_CR139_PHY_WRLV_EN(v)                     ((v) & 0xff)
 #define DDRMC_CR154_PAD_ZQ_EARLY_CMP_EN_TIMER(v)       (((v) & 0x1f) << 27)
 #define DDRMC_CR154_PAD_ZQ_MODE(v)                     (((v) & 0x3) << 21)
+#define DDRMC_CR154_DDR_SEL_PAD_CONTR(v)               (((v) & 0x3) << 18)
 #define DDRMC_CR155_AXI0_AWCACHE                       (1 << 10)
 #define DDRMC_CR155_PAD_ODT_BYTE1(v)                   ((v) & 0x7)
 #define DDRMC_CR158_TWR(v)                             ((v) & 0x3f)
index 318ca01ea7f6df0ed39f04bb6152454b61d96d21..6de920eb43735f08e5949902975fedc250374454 100644 (file)
@@ -628,13 +628,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
        }
 #endif
 
-#ifdef CONFIG_MODEM_SUPPORT
- {
-        extern int do_mdm_init;
-        do_mdm_init = gd->do_mdm_init;
- }
-#endif
-
 #ifdef CONFIG_WATCHDOG
        /* disable watchdog if environment is set */
        if ((s = getenv ("watchdog")) != NULL) {
index 2c013bbe5d122a6388bbda297357e3d3db00ef7e..0a47fdc1d36c047a7340bae19e6095d94310bcd8 100644 (file)
@@ -242,8 +242,6 @@ void pci_mpc8250_init (struct pci_controller *hose)
        immap->im_siu_conf.sc_siumcr =
                (immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11)
                | SIUMCR_LBPC01;
-#elif defined(CONFIG_ADSTYPE) && CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS
-/* nothing to do for this board here */
 #elif defined CONFIG_MPC8272
        immap->im_siu_conf.sc_siumcr = (immap->im_siu_conf.sc_siumcr &
                                  ~SIUMCR_BBD &
index 324f132bad822ad4f7ea6233f6e033f7ce645807..d7eaf13e0bda2b7e77e313beebb494695631962d 100644 (file)
@@ -137,19 +137,6 @@ _hrcw_table:
 
        .globl  _start
 _start:
-#if defined(CONFIG_MPC8260ADS) && defined(CONFIG_SYS_DEFAULT_IMMR)
-       lis     r3, CONFIG_SYS_DEFAULT_IMMR@h
-       nop
-       lwz     r4, 0(r3)
-       nop
-       rlwinm  r4, r4, 0, 8, 5
-       nop
-       oris    r4, r4, 0x0200
-       nop
-       stw     r4, 0(r3)
-       nop
-#endif /* CONFIG_MPC8260ADS && CONFIG_SYS_DEFAULT_IMMR */
-
        mfmsr   r5                      /* save msr contents            */
 
 #if defined(CONFIG_COGENT)
index edd7375c18bc139f0dc58405e8425c5aa8294cde..a5e7a612bfd136b718af6cf83e4b28918ef47abe 100644 (file)
@@ -1346,26 +1346,14 @@ void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
 #if defined(CONFIG_8xx)
 #define _machine _MACH_8xx
 #define have_of 0
-#elif defined(CONFIG_OAK)
-#define _machine _MACH_oak
-#define have_of        0
 #elif defined(CONFIG_WALNUT)
 #define _machine _MACH_walnut
 #define have_of 0
-#elif defined(CONFIG_APUS)
-#define _machine _MACH_apus
-#define have_of 0
-#elif defined(CONFIG_GEMINI)
-#define _machine _MACH_gemini
-#define have_of 0
 #elif defined(CONFIG_MPC8260)
 #define _machine _MACH_8260
 #define have_of 0
 #elif defined(CONFIG_SANDPOINT)
 #define _machine _MACH_sandpoint
-#elif defined(CONFIG_HIDDEN_DRAGON)
-#define _machine _MACH_hidden_dragon
-#define have_of 0
 #else
 #error "Machine not defined correctly"
 #endif
index 57b4a09b04e320aed88fad76b80c49c04fee2f04..300ab12a3b593fd5704e6fab59a33595e411df7c 100644 (file)
@@ -991,14 +991,6 @@ void board_init_r(gd_t *id, ulong dest_addr)
        kbd_init();
 #endif
 
-#ifdef CONFIG_MODEM_SUPPORT
-       {
-               extern int do_mdm_init;
-
-               do_mdm_init = gd->do_mdm_init;
-       }
-#endif
-
        /* Initialization complete - start the monitor */
 
        /* main_loop() can return to retry autoboot, if so just run it again. */
index 95b59da6b4dc3c450b8e43f731a020243eec3355..8317db1ad3d896a5f7ddefea6b9dd8dfe2a4dae3 100644 (file)
@@ -29,7 +29,7 @@
  * @param gp   GPIO number
  * @return -1 on error, 0 if GPIO is low, >0 if high
  */
-int sandbox_gpio_get_value(struct device *dev, unsigned int offset);
+int sandbox_gpio_get_value(struct udevice *dev, unsigned int offset);
 
 /**
  * Set the simulated value of a GPIO (used only in sandbox test code)
@@ -38,7 +38,7 @@ int sandbox_gpio_get_value(struct device *dev, unsigned int offset);
  * @param value        value to set (0 for low, non-zero for high)
  * @return -1 on error, 0 if ok
  */
-int sandbox_gpio_set_value(struct device *dev, unsigned int offset, int value);
+int sandbox_gpio_set_value(struct udevice *dev, unsigned int offset, int value);
 
 /**
  * Return the simulated direction of a GPIO (used only in sandbox test code)
@@ -46,7 +46,7 @@ int sandbox_gpio_set_value(struct device *dev, unsigned int offset, int value);
  * @param gp   GPIO number
  * @return -1 on error, 0 if GPIO is input, >0 if output
  */
-int sandbox_gpio_get_direction(struct device *dev, unsigned int offset);
+int sandbox_gpio_get_direction(struct udevice *dev, unsigned int offset);
 
 /**
  * Set the simulated direction of a GPIO (used only in sandbox test code)
@@ -55,7 +55,7 @@ int sandbox_gpio_get_direction(struct device *dev, unsigned int offset);
  * @param output 0 to set as input, 1 to set as output
  * @return -1 on error, 0 if ok
  */
-int sandbox_gpio_set_direction(struct device *dev, unsigned int offset,
+int sandbox_gpio_set_direction(struct udevice *dev, unsigned int offset,
                               int output);
 
 #endif
diff --git a/board/abilis/tb100/Makefile b/board/abilis/tb100/Makefile
new file mode 100644 (file)
index 0000000..4f273b3
--- /dev/null
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2014 Pierrick Hascoet, Abilis Systems
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y  += tb100.o
diff --git a/board/abilis/tb100/tb100.c b/board/abilis/tb100/tb100.c
new file mode 100644 (file)
index 0000000..ff3632f
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * (C) Copyright 2014 Pierrick Hascoet, Abilis Systems
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <netdev.h>
+#include <asm/io.h>
+
+void reset_cpu(ulong addr)
+{
+#define CRM_SWRESET    0xff101044
+       writel(0x1, (void *)CRM_SWRESET);
+}
+
+int board_eth_init(bd_t *bis)
+{
+       if (designware_initialize(ETH0_BASE_ADDRESS, 0) >= 0)
+               return 1;
+
+       return 0;
+}
diff --git a/board/adder/Makefile b/board/adder/Makefile
deleted file mode 100644 (file)
index 8dc505a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# Copyright (C) 2004 Arabella Software Ltd.
-# Yuli Barcohen <yuli@arabellasw.com>
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  := adder.o
diff --git a/board/adder/adder.c b/board/adder/adder.c
deleted file mode 100644 (file)
index 2ee7096..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2004-2005 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * Support for Analogue&Micro Adder boards family.
- * Tested on AdderII and Adder87x.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc8xx.h>
-#if defined(CONFIG_OF_LIBFDT)
-       #include <libfdt.h>
-#endif
-
-/*
- * SDRAM is single Samsung K4S643232F-T70   chip (8MB)
- *       or single Micron  MT48LC4M32B2TG-7 chip (16MB).
- * Minimal CPU frequency is 40MHz.
- */
-static uint sdram_table[] = {
-       /* Single read  (offset 0x00 in UPM RAM) */
-       0x1f07fc24, 0xe0aefc04, 0x10adfc04, 0xe0bbbc00,
-       0x10f77c44, 0xf3fffc07, 0xfffffc04, 0xfffffc04,
-
-       /* Burst read   (offset 0x08 in UPM RAM) */
-       0x1f07fc24, 0xe0aefc04, 0x10adfc04, 0xf0affc00,
-       0xf0affc00, 0xf0affc00, 0xf0affc00, 0x10a77c44,
-       0xf7bffc47, 0xfffffc35, 0xfffffc34, 0xfffffc35,
-       0xfffffc35, 0x1ff77c35, 0xfffffc34, 0x1fb57c35,
-
-       /* Single write (offset 0x18 in UPM RAM) */
-       0x1f27fc24, 0xe0aebc04, 0x00b93c00, 0x13f77c47,
-       0xfffdfc04, 0xfffffc04, 0xfffffc04, 0xfffffc04,
-
-       /* Burst write  (offset 0x20 in UPM RAM) */
-       0x1f07fc24, 0xeeaebc00, 0x10ad7c00, 0xf0affc00,
-       0xf0affc00, 0xe0abbc00, 0x1fb77c47, 0xfffffc04,
-       0xfffffc04, 0xfffffc04, 0xfffffc04, 0xfffffc04,
-       0xfffffc04, 0xfffffc04, 0xfffffc04, 0xfffffc04,
-
-       /* Refresh      (offset 0x30 in UPM RAM) */
-       0x1ff5fc84, 0xfffffc04, 0xfffffc04, 0xfffffc04,
-       0xfffffc84, 0xfffffc07, 0xfffffc04, 0xfffffc04,
-       0xfffffc04, 0xfffffc04, 0xfffffc04, 0xfffffc04,
-
-       /* Exception    (offset 0x3C in UPM RAM) */
-       0xfffffc27, 0xfffffc04, 0xfffffc04, 0xfffffc04
-};
-
-phys_size_t initdram (int board_type)
-{
-       long int msize;
-       volatile immap_t     *immap  = (volatile immap_t *)CONFIG_SYS_IMMR;
-       volatile memctl8xx_t *memctl = &immap->im_memctl;
-
-       upmconfig(UPMA, sdram_table, sizeof(sdram_table) / sizeof(uint));
-
-       /* Configure SDRAM refresh */
-       memctl->memc_mptpr = MPTPR_PTP_DIV32; /* BRGCLK/32 */
-
-       memctl->memc_mamr = (94 << 24) | CONFIG_SYS_MAMR; /* No refresh */
-       udelay(200);
-
-       /* Run precharge from location 0x15 */
-       memctl->memc_mar = 0x0;
-       memctl->memc_mcr = 0x80002115;
-       udelay(200);
-
-       /* Run 8 refresh cycles */
-       memctl->memc_mcr = 0x80002830;
-       udelay(200);
-
-       /* Run MRS pattern from location 0x16 */
-       memctl->memc_mar = 0x88;
-       memctl->memc_mcr = 0x80002116;
-       udelay(200);
-
-       memctl->memc_mamr |=  MAMR_PTAE; /* Enable refresh */
-       memctl->memc_or1   = ~(CONFIG_SYS_SDRAM_MAX_SIZE - 1) | OR_CSNT_SAM;
-       memctl->memc_br1   =  CONFIG_SYS_SDRAM_BASE | BR_PS_32 | BR_MS_UPMA | BR_V;
-
-       msize = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_SDRAM_MAX_SIZE);
-       memctl->memc_or1  |= ~(msize - 1);
-
-       return msize;
-}
-
-int checkboard( void )
-{
-       puts("Board: Adder");
-#if defined(CONFIG_MPC885_FAMILY)
-       puts("87x\n");
-#elif defined(CONFIG_MPC866_FAMILY)
-       puts("II\n");
-#endif
-
-       return 0;
-}
-
-#if defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
-{
-       ft_cpu_setup(blob, bd);
-
-}
-#endif
diff --git a/board/adder/u-boot.lds b/board/adder/u-boot.lds
deleted file mode 100644 (file)
index 38567d1..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * (C) Copyright 2001-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Modified by Yuli Barcohen <yuli@arabellasw.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-OUTPUT_ARCH(powerpc)
-SECTIONS
-{
-  /* Read-only sections, merged into text segment: */
-  . = + SIZEOF_HEADERS;
-  .text          :
-  {
-    arch/powerpc/cpu/mpc8xx/start.o    (.text*)
-    arch/powerpc/cpu/mpc8xx/traps.o    (.text*)
-    *(.text*)
-    . = ALIGN(16);
-    *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
-  }
-
-  /* Read-write section, merged into data segment: */
-  . = (. + 0x0FFF) & 0xFFFFF000;
-  _erotext = .;
-  PROVIDE (erotext = .);
-  .reloc   :
-  {
-    _GOT2_TABLE_ = .;
-    KEEP(*(.got2))
-    KEEP(*(.got))
-    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
-    _FIXUP_TABLE_ = .;
-    KEEP(*(.fixup))
-  }
-  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
-  __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
-
-  .data    :
-  {
-    *(.data*)
-    *(.sdata*)
-  }
-  _edata  =  .;
-  PROVIDE (edata = .);
-
-  . = .;
-
-  . = ALIGN(4);
-  .u_boot_list : {
-       KEEP(*(SORT(.u_boot_list*)));
-  }
-
-
-  . = .;
-  __start___ex_table = .;
-  __ex_table : { *(__ex_table) }
-  __stop___ex_table = .;
-
-  . = ALIGN(4096);
-  __init_begin = .;
-  .text.init : { *(.text.init) }
-  .data.init : { *(.data.init) }
-  . = ALIGN(4096);
-  __init_end = .;
-
-  __bss_start = .;
-  .bss (NOLOAD)       :
-  {
-   *(.bss*)
-   *(.sbss*)
-   *(COMMON)
-   . = ALIGN(4);
-  }
-  __bss_end = . ;
-  PROVIDE (end = .);
-}
-ENTRY(_start)
index 7e1b16ac4655317e121fe46e5adf5159bd86f10d..9aa1d7aece41f56fa1451f18e23274b9a84eaeba 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <errno.h>
-#include <hush.h>
 #include <linux/mtd/nand.h>
 #include <nand.h>
 #include <miiphy.h>
@@ -777,7 +777,7 @@ static void ait_menu_read_env(char *name)
 
        sprintf(output, "%s old: %s value: ", name, getenv(name));
        memset(cbuf, 0, CONFIG_SYS_CBSIZE);
-       readret = readline_into_buffer(output, cbuf, 0);
+       readret = cli_readline_into_buffer(output, cbuf, 0);
 
        if (readret >= 0) {
                ret = setenv(name, cbuf);
index dc78b73731596407c11efb463cac44ebd7364161..c1724bf03480819f256f3c7003a6d864c1be887a 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include "yucca.h"
 #include <i2c.h>
@@ -51,7 +52,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
 
        do {
                printf("enter sys clock frequency 33 or 66 MHz or quit to abort\n");
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
@@ -74,7 +75,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
                        printf("enter cpu clock frequency 400, 500, 533 MHz or quit to abort\n");
 #endif
                }
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
@@ -118,7 +119,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
                                printf("enter plb clock frequency 133, 166 MHz or quit to abort\n");
 
 #endif
-                       nbytes = readline (" ? ");
+                       nbytes = cli_readline(" ? ");
 
                        if (strcmp(console_buffer, "quit") == 0)
                                return 0;
@@ -142,7 +143,7 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
 
        do {
                printf("enter Pci-X clock frequency 33, 66, 100 or 133 MHz or quit to abort\n");
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
 
                if (strcmp(console_buffer, "quit") == 0)
                        return 0;
@@ -163,13 +164,13 @@ static int setBootStrapClock(cmd_tbl_t *cmdtp, int incrflag, int flag,
        printf("Pci-X clk = %s MHz\n", pcixClock);
 
        do {
-               printf("\npress [y] to write I2C bootstrap \n");
-               printf("or [n] to abort.  \n");
-               printf("Don't forget to set board switches \n");
-               printf("according to your choice before re-starting \n");
-               printf("(refer to 440spe_uboot_kit_um_1_01.pdf) \n");
+               printf("\npress [y] to write I2C bootstrap\n");
+               printf("or [n] to abort.\n");
+               printf("Don't forget to set board switches\n");
+               printf("according to your choice before re-starting\n");
+               printf("(refer to 440spe_uboot_kit_um_1_01.pdf)\n");
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (strcmp(console_buffer, "n") == 0)
                        return 0;
 
index b7e2efd2fce14bee705c3630ba9ee1a1347f1407..57881164c5a72682145df07e170128dfcefd41b4 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch/clk.h>
 #include <lcd.h>
 #include <atmel_lcdc.h>
+#include <atmel_mci.h>
 #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
 #include <net.h>
 #endif
@@ -217,6 +218,15 @@ void lcd_show_board_info(void)
 #endif /* CONFIG_LCD_INFO */
 #endif
 
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bis)
+{
+       at91_mci_hw_init();
+
+       return atmel_mci_init((void *)ATMEL_BASE_MCI0);
+}
+#endif
+
 int board_early_init_f(void)
 {
        at91_seriald_hw_init();
index 39f2dc6475d13a98dfcd63707965602d4033ae4e..92ed4e81d3902ea5b8c53107e6ac833b5693c967 100644 (file)
@@ -17,6 +17,9 @@
 #include <atmel_mci.h>
 #include <net.h>
 #include <netdev.h>
+#include <spl.h>
+#include <asm/arch/atmel_mpddrc.h>
+#include <asm/arch/at91_wdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -128,3 +131,87 @@ int board_mmc_init(bd_t *bis)
        return 0;
 }
 #endif
+
+/* SPL */
+#ifdef CONFIG_SPL_BUILD
+void spl_board_init(void)
+{
+#ifdef CONFIG_SYS_USE_MMC
+       sama5d3_xplained_mci0_hw_init();
+#elif CONFIG_SYS_USE_NANDFLASH
+       sama5d3_xplained_nand_hw_init();
+#endif
+}
+
+static void ddr2_conf(struct atmel_mpddr *ddr2)
+{
+       ddr2->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);
+
+       ddr2->cr = (ATMEL_MPDDRC_CR_NC_COL_10 |
+                   ATMEL_MPDDRC_CR_NR_ROW_14 |
+                   ATMEL_MPDDRC_CR_CAS_DDR_CAS3 |
+                   ATMEL_MPDDRC_CR_ENRDM_ON |
+                   ATMEL_MPDDRC_CR_NB_8BANKS |
+                   ATMEL_MPDDRC_CR_NDQS_DISABLED |
+                   ATMEL_MPDDRC_CR_DECOD_INTERLEAVED |
+                   ATMEL_MPDDRC_CR_UNAL_SUPPORTED);
+       /*
+        * As the DDR2-SDRAm device requires a refresh time is 7.8125us
+        * when DDR run at 133MHz, so it needs (7.8125us * 133MHz / 10^9) clocks
+        */
+       ddr2->rtr = 0x411;
+
+       ddr2->tpr0 = (6 << ATMEL_MPDDRC_TPR0_TRAS_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR0_TRCD_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR0_TWR_OFFSET |
+                     8 << ATMEL_MPDDRC_TPR0_TRC_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR0_TRP_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR0_TRRD_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR0_TWTR_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR0_TMRD_OFFSET);
+
+       ddr2->tpr1 = (2 << ATMEL_MPDDRC_TPR1_TXP_OFFSET |
+                     200 << ATMEL_MPDDRC_TPR1_TXSRD_OFFSET |
+                     28 << ATMEL_MPDDRC_TPR1_TXSNR_OFFSET |
+                     26 << ATMEL_MPDDRC_TPR1_TRFC_OFFSET);
+
+       ddr2->tpr2 = (7 << ATMEL_MPDDRC_TPR2_TFAW_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR2_TRTP_OFFSET |
+                     2 << ATMEL_MPDDRC_TPR2_TRPA_OFFSET |
+                     7 << ATMEL_MPDDRC_TPR2_TXARDS_OFFSET |
+                     8 << ATMEL_MPDDRC_TPR2_TXARD_OFFSET);
+}
+
+void mem_init(void)
+{
+       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+       struct atmel_mpddr ddr2;
+
+       ddr2_conf(&ddr2);
+
+       /* enable MPDDR clock */
+       at91_periph_clk_enable(ATMEL_ID_MPDDRC);
+       writel(0x4, &pmc->scer);
+
+       /* DDRAM2 Controller initialize */
+       ddr2_init(ATMEL_BASE_DDRCS, &ddr2);
+}
+
+void at91_pmc_init(void)
+{
+       struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+       u32 tmp;
+
+       tmp = AT91_PMC_PLLAR_29 |
+             AT91_PMC_PLLXR_PLLCOUNT(0x3f) |
+             AT91_PMC_PLLXR_MUL(43) |
+             AT91_PMC_PLLXR_DIV(1);
+       at91_plla_init(tmp);
+
+       writel(0x3 << 8, &pmc->pllicpr);
+
+       tmp = AT91_PMC_MCKR_MDIV_4 |
+             AT91_PMC_MCKR_CSS_PLLA;
+       at91_mck_init(tmp);
+}
+#endif
index d80eaba2d0a4d7e362af254650da05f44475c6a5..2acf80047fe0f98b197a9eb9b36fe46b4a0fd718 100644 (file)
@@ -7,6 +7,7 @@
 
 /* includes */
 #include <common.h>
+#include <cli.h>
 #include <linux/ctype.h>
 #include <pci.h>
 #include <net.h>
@@ -113,7 +114,7 @@ int misc_init_r (void)
                printf ("Press key:\n  <c> to copy current revision info to nvram.\n");
                printf ("  <r> to reenter revision info.\n");
                printf ("=> ");
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        switch ((char) toupper (console_buffer[0])) {
                        case 'C':
                                copyNv = 1;
@@ -130,7 +131,7 @@ int misc_init_r (void)
                memcpy (buf, &eerev.revision[0][0], 14);        /* save all revision info */
                printf ("Enter revision number (0-9): %c  ",
                        eerev.revision[0][0]);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        eerev.revision[0][0] =
                                (char) toupper (console_buffer[0]);
                        memcpy (&eerev.revision[1][0], buf, 12);        /* shift rest of rev info */
@@ -138,14 +139,14 @@ int misc_init_r (void)
 
                printf ("Enter revision character (A-Z): %c  ",
                        eerev.revision[0][1]);
-               if (1 == readline (NULL)) {
+               if (1 == cli_readline(NULL)) {
                        eerev.revision[0][1] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter board name (V-XXXX-XXXX): %s  ",
                        (char *) &eerev.board);
-               if (11 == readline (NULL)) {
+               if (11 == cli_readline(NULL)) {
                        for (i = 0; i < 11; i++)
                                eerev.board[i] =
                                        (char) toupper (console_buffer[i]);
@@ -153,14 +154,14 @@ int misc_init_r (void)
                }
 
                printf ("Enter serial number: %s ", (char *) &eerev.serial);
-               if (6 == readline (NULL)) {
+               if (6 == cli_readline(NULL)) {
                        for (i = 0; i < 6; i++)
                                eerev.serial[i] = console_buffer[i];
                        eerev.serial[6] = '\0';
                }
 
                printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x  ", eerev.etheraddr[0], eerev.etheraddr[1], eerev.etheraddr[2], eerev.etheraddr[3], eerev.etheraddr[4], eerev.etheraddr[5]);
-               if (12 == readline (NULL)) {
+               if (12 == cli_readline(NULL)) {
                        for (i = 0; i < 12; i += 2)
                                eerev.etheraddr[i >> 1] =
                                        (char) (16 *
@@ -175,7 +176,7 @@ int misc_init_r (void)
                l = strlen ((char *) &eerev.text);
                printf ("Add to text section (max 64 chr): %s ",
                        (char *) &eerev.text);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        for (i = l; i < 63; i++)
                                eerev.text[i] = console_buffer[i - l];
                        eerev.text[63] = '\0';
index f3f564ffe4ba5ca9b59691a47b4673ad4f494946..5781b2a54f3888203df4e4dbc077ffd24ca07c26 100644 (file)
@@ -14,6 +14,7 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 #include <common.h>
+#include <cli.h>
 #include <linux/ctype.h>
 #include <commproc.h>
 #include "mpc8xx.h"
@@ -146,21 +147,21 @@ int misc_init_r (void)
        if (strncmp ((char *) &mhpcRevInfo.board[2], "MHPC", 4) != 0) {
                printf ("Enter revision number (0-9): %c  ",
                        mhpcRevInfo.revision[0]);
-               if (0 != readline (NULL)) {
+               if (0 != cli_readline(NULL)) {
                        mhpcRevInfo.revision[0] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter revision character (A-Z): %c  ",
                        mhpcRevInfo.revision[1]);
-               if (1 == readline (NULL)) {
+               if (1 == cli_readline(NULL)) {
                        mhpcRevInfo.revision[1] =
                                (char) toupper (console_buffer[0]);
                }
 
                printf ("Enter board name (V-XXXX-XXXX): %s  ",
                        (char *) &mhpcRevInfo.board);
-               if (11 == readline (NULL)) {
+               if (11 == cli_readline(NULL)) {
                        for (i = 0; i < 11; i++) {
                                mhpcRevInfo.board[i] =
                                        (char) toupper (console_buffer[i]);
@@ -177,7 +178,7 @@ int misc_init_r (void)
                do {
                        printf ("\nEnter sensor number (0-255): %d  ",
                                (int) mhpcRevInfo.sensor);
-                       if (0 != readline (NULL)) {
+                       if (0 != cli_readline(NULL)) {
                                mhpcRevInfo.sensor =
                                        (unsigned char)
                                        simple_strtoul (console_buffer, NULL,
@@ -187,7 +188,7 @@ int misc_init_r (void)
 
                printf ("Enter serial number: %s ",
                        (char *) &mhpcRevInfo.serial);
-               if (6 == readline (NULL)) {
+               if (6 == cli_readline(NULL)) {
                        for (i = 0; i < 6; i++) {
                                mhpcRevInfo.serial[i] = console_buffer[i];
                        }
@@ -195,7 +196,7 @@ int misc_init_r (void)
                }
 
                printf ("Enter ether node ID with leading zero (HEX): %02x%02x%02x%02x%02x%02x  ", mhpcRevInfo.etheraddr[0], mhpcRevInfo.etheraddr[1], mhpcRevInfo.etheraddr[2], mhpcRevInfo.etheraddr[3], mhpcRevInfo.etheraddr[4], mhpcRevInfo.etheraddr[5]);
-               if (12 == readline (NULL)) {
+               if (12 == cli_readline(NULL)) {
                        for (i = 0; i < 12; i += 2) {
                                mhpcRevInfo.etheraddr[i >> 1] =
                                        (char) (16 *
diff --git a/board/ep8248/Makefile b/board/ep8248/Makefile
deleted file mode 100644 (file)
index bfaf1c8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2001-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  := ep8248.o
diff --git a/board/ep8248/ep8248.c b/board/ep8248/ep8248.c
deleted file mode 100644 (file)
index 736c180..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (C) 2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * Support for Embedded Planet EP8248 boards.
- * Tested on EP8248E.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc8260.h>
-#include <ioports.h>
-
-/*
- * I/O Port configuration table
- *
- * if conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-#define CONFIG_SYS_FCC1 (CONFIG_ETHER_ON_FCC1 == 1)
-#define CONFIG_SYS_FCC2 (CONFIG_ETHER_ON_FCC2 == 1)
-
-const iop_conf_t iop_conf_tab[4][32] = {
-
-    /* Port A */
-    {  /*            conf      ppar psor pdir podr pdat */
-       /* PA31 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII COL    */
-       /* PA30 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII CRS    */
-       /* PA29 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_ER  */
-       /* PA28 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_EN  */
-       /* PA27 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_DV  */
-       /* PA26 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_ER  */
-       /* PA25 */ { 0,          0,   0,   0,   0,   0 }, /* PA25            */
-       /* PA24 */ { 0,          0,   0,   0,   0,   0 }, /* PA24            */
-       /* PA23 */ { 0,          0,   0,   0,   0,   0 }, /* PA23            */
-       /* PA22 */ { 0,          0,   0,   0,   0,   0 }, /* PA22            */
-       /* PA21 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[3] */
-       /* PA20 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[2] */
-       /* PA19 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[1] */
-       /* PA18 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[0] */
-       /* PA17 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[0] */
-       /* PA16 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[1] */
-       /* PA15 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[2] */
-       /* PA14 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[3] */
-       /* PA13 */ { 0,          0,   0,   0,   0,   0 }, /* PA13            */
-       /* PA12 */ { 0,          0,   0,   0,   0,   0 }, /* PA12            */
-       /* PA11 */ { 0,          0,   0,   0,   0,   0 }, /* PA11            */
-       /* PA10 */ { 0,          0,   0,   0,   0,   0 }, /* PA10            */
-       /* PA9  */ { 0,          1,   0,   1,   0,   0 }, /* SMC2 TxD        */
-       /* PA8  */ { 0,          1,   0,   0,   0,   0 }, /* SMC2 RxD        */
-       /* PA7  */ { 0,          0,   0,   0,   0,   0 }, /* PA7             */
-       /* PA6  */ { 0,          0,   0,   0,   0,   0 }, /* PA6             */
-       /* PA5  */ { 0,          0,   0,   0,   0,   0 }, /* PA5             */
-       /* PA4  */ { 0,          0,   0,   0,   0,   0 }, /* PA4             */
-       /* PA3  */ { 0,          0,   0,   0,   0,   0 }, /* PA3             */
-       /* PA2  */ { 0,          0,   0,   0,   0,   0 }, /* PA2             */
-       /* PA1  */ { 0,          0,   0,   0,   0,   0 }, /* PA1             */
-       /* PA0  */ { 0,          0,   0,   0,   0,   0 }  /* PA0             */
-    },
-
-    /* Port B */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PB31 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TX_ER  */
-       /* PB30 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_DV  */
-       /* PB29 */ { CONFIG_SYS_FCC2,   1,   1,   1,   0,   0 }, /* FCC2 MII TX_EN  */
-       /* PB28 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_ER  */
-       /* PB27 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII COL    */
-       /* PB26 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII CRS    */
-       /* PB25 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[3] */
-       /* PB24 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[2] */
-       /* PB23 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[1] */
-       /* PB22 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[0] */
-       /* PB21 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[0] */
-       /* PB20 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[1] */
-       /* PB19 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[2] */
-       /* PB18 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[3] */
-       /* PB17 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB16 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB15 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB14 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB13 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB12 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB11 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB10 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB9  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB8  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB7  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB6  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB5  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB4  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB3  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB2  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB1  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB0  */ { 0,          0,   0,   0,   0,   0 }  /* non-existent    */
-    },
-
-    /* Port C */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PC31 */ { 0,          0,   0,   0,   0,   0 }, /* PC31            */
-       /* PC30 */ { 0,          0,   0,   0,   0,   0 }, /* PC30            */
-       /* PC29 */ { 0,          0,   0,   0,   0,   0 }, /* PC29            */
-       /* PC28 */ { 0,          0,   0,   0,   0,   0 }, /* PC28            */
-       /* PC27 */ { 0,          0,   0,   0,   0,   0 }, /* PC27            */
-       /* PC26 */ { 0,          0,   0,   0,   0,   0 }, /* PC26            */
-       /* PC25 */ { 0,          0,   0,   0,   0,   0 }, /* PC25            */
-       /* PC24 */ { 0,          0,   0,   0,   0,   0 }, /* PC24            */
-       /* PC23 */ { 0,          0,   0,   0,   0,   0 }, /* PC23            */
-       /* PC22 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 RxClk (CLK10) */
-       /* PC21 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 TxClk (CLK11) */
-       /* PC20 */ { 0,          0,   0,   0,   0,   0 }, /* PC20            */
-       /* PC19 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 RxClk (CLK13) */
-       /* PC18 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 TxClk (CLK14) */
-       /* PC17 */ { 0,          0,   0,   0,   0,   0 }, /* PC17            */
-       /* PC16 */ { 0,          0,   0,   0,   0,   0 }, /* PC16            */
-       /* PC15 */ { 0,          0,   0,   0,   0,   0 }, /* PC15            */
-       /* PC14 */ { 0,          0,   0,   0,   0,   0 }, /* PC14            */
-       /* PC13 */ { 0,          0,   0,   0,   0,   0 }, /* PC13            */
-       /* PC12 */ { 0,          0,   0,   0,   0,   0 }, /* PC12            */
-       /* PC11 */ { 0,          0,   0,   0,   0,   0 }, /* PC11            */
-       /* PC10 */ { 0,          0,   0,   0,   0,   0 }, /* PC10            */
-       /* PC9  */ { 1,          0,   0,   1,   0,   1 }, /* MDIO            */
-       /* PC8  */ { 1,          0,   0,   1,   0,   1 }, /* MDC             */
-       /* PC7  */ { 0,          0,   0,   0,   0,   0 }, /* PC7             */
-       /* PC6  */ { 0,          0,   0,   0,   0,   0 }, /* PC6             */
-       /* PC5  */ { 1,          1,   0,   1,   0,   0 }, /* SMC1 TxD        */
-       /* PC4  */ { 1,          1,   0,   0,   0,   0 }, /* SMC1 RxD        */
-       /* PC3  */ { 0,          0,   0,   0,   0,   0 }, /* PC3             */
-       /* PC2  */ { 0,          0,   0,   0,   0,   0 }, /* PC2             */
-       /* PC1  */ { 0,          0,   0,   0,   0,   0 }, /* PC1             */
-       /* PC0  */ { 0,          0,   0,   0,   0,   0 }, /* PC0             */
-    },
-
-    /* Port D */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PD31 */ { 1,          1,   0,   0,   0,   0 }, /* SCC1 RxD        */
-       /* PD30 */ { 1,          1,   1,   1,   0,   0 }, /* SCC1 TxD        */
-       /* PD29 */ { 0,          0,   0,   0,   0,   0 }, /* PD29            */
-       /* PD28 */ { 0,          0,   0,   0,   0,   0 }, /* PD28            */
-       /* PD27 */ { 0,          0,   0,   0,   0,   0 }, /* PD27            */
-       /* PD26 */ { 0,          0,   0,   0,   0,   0 }, /* PD26            */
-       /* PD25 */ { 0,          0,   0,   0,   0,   0 }, /* PD25            */
-       /* PD24 */ { 0,          0,   0,   0,   0,   0 }, /* PD24            */
-       /* PD23 */ { 0,          0,   0,   0,   0,   0 }, /* PD23            */
-       /* PD22 */ { 0,          0,   0,   0,   0,   0 }, /* PD22            */
-       /* PD21 */ { 0,          0,   0,   0,   0,   0 }, /* PD21            */
-       /* PD20 */ { 0,          0,   0,   0,   0,   0 }, /* PD20            */
-       /* PD19 */ { 0,          0,   0,   0,   0,   0 }, /* PD19            */
-       /* PD18 */ { 0,          0,   0,   0,   0,   0 }, /* PD18            */
-       /* PD17 */ { 0,          0,   0,   0,   0,   0 }, /* PD17            */
-       /* PD16 */ { 0,          0,   0,   0,   0,   0 }, /* PD16            */
-       /* PD15 */ { 1,          1,   1,   0,   1,   0 }, /* I2C SDA         */
-       /* PD14 */ { 1,          1,   1,   0,   1,   0 }, /* I2C SCL         */
-       /* PD13 */ { 0,          0,   0,   0,   0,   0 }, /* PD13            */
-       /* PD12 */ { 0,          0,   0,   0,   0,   0 }, /* PD12            */
-       /* PD11 */ { 0,          0,   0,   0,   0,   0 }, /* PD11            */
-       /* PD10 */ { 0,          0,   0,   0,   0,   0 }, /* PD10            */
-       /* PD9  */ { 0,          0,   0,   0,   0,   0 }, /* PD9             */
-       /* PD8  */ { 0,          0,   0,   0,   0,   0 }, /* PD8             */
-       /* PD7  */ { 0,          0,   0,   0,   0,   0 }, /* PD7             */
-       /* PD6  */ { 0,          0,   0,   0,   0,   0 }, /* PD6             */
-       /* PD5  */ { 0,          0,   0,   0,   0,   0 }, /* PD5             */
-       /* PD4  */ { 0,          0,   0,   0,   0,   0 }, /* PD4             */
-       /* PD3  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PD2  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PD1  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PD0  */ { 0,          0,   0,   0,   0,   0 }  /* non-existent    */
-    }
-};
-
-int board_early_init_f (void)
-{
-       vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
-
-       bcsr[4] |= 0x30; /* Turn the LEDs off */
-
-#if defined(CONFIG_CONS_ON_SMC) || defined(CONFIG_KGDB_ON_SMC)
-       bcsr[6] |= 0x10;
-#endif
-#if defined(CONFIG_CONS_ON_SCC) || defined(CONFIG_KGDB_ON_SCC)
-       bcsr[7] |= 0x10;
-#endif
-
-#if CONFIG_SYS_FCC1
-       bcsr[8] |= 0xC0;
-#endif /* CONFIG_SYS_FCC1 */
-#if CONFIG_SYS_FCC2
-       bcsr[8] |= 0x30;
-#endif /* CONFIG_SYS_FCC2 */
-
-       return 0;
-}
-
-phys_size_t initdram(int board_type)
-{
-       vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
-       long int msize = 16L << (bcsr[2] & 3);
-
-#ifndef CONFIG_SYS_RAMBOOT
-       volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-       volatile memctl8260_t *memctl = &immap->im_memctl;
-       vu_char *ramaddr = (vu_char *)CONFIG_SYS_SDRAM_BASE;
-       uchar c = 0xFF;
-       uint psdmr = CONFIG_SYS_PSDMR;
-       int i;
-
-       immap->im_siu_conf.sc_ppc_acr  = 0x02;
-       immap->im_siu_conf.sc_ppc_alrh = 0x30126745;
-       immap->im_siu_conf.sc_tescr1   = 0x00004000;
-
-       memctl->memc_mptpr = CONFIG_SYS_MPTPR;
-
-       /* Initialise 60x bus SDRAM */
-       memctl->memc_psrt = CONFIG_SYS_PSRT;
-       memctl->memc_or1  = CONFIG_SYS_SDRAM_OR;
-       memctl->memc_br1  = CONFIG_SYS_SDRAM_BR;
-       memctl->memc_psdmr = psdmr | PSDMR_OP_PREA; /* Precharge all banks */
-       *ramaddr = c;
-       memctl->memc_psdmr = psdmr | PSDMR_OP_CBRR; /* CBR refresh */
-       for (i = 0; i < 8; i++)
-               *ramaddr = c;
-       memctl->memc_psdmr = psdmr | PSDMR_OP_MRW;  /* Mode Register write */
-       *ramaddr = c;
-       memctl->memc_psdmr = psdmr | PSDMR_RFEN;    /* Refresh enable */
-       *ramaddr = c;
-#endif /* !CONFIG_SYS_RAMBOOT */
-
-       /* Return total 60x bus SDRAM size */
-       return msize * 1024 * 1024;
-}
-
-int checkboard(void)
-{
-       vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
-
-       puts("Board: ");
-       switch (bcsr[0]) {
-       case 0x0C:
-               printf("EP8248E 1.0 CPLD revision %d\n", bcsr[1]);
-               break;
-       default:
-               printf("unknown: ID=%02X\n", bcsr[0]);
-       }
-
-       return 0;
-}
-
-#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-void ft_board_setup(void *blob, bd_t *bd)
-{
-       ft_cpu_setup( blob, bd);
-}
-#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
diff --git a/board/etin/debris/Makefile b/board/etin/debris/Makefile
deleted file mode 100644 (file)
index 2e74823..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y =  debris.o flash.o phantom.o
diff --git a/board/etin/debris/debris.c b/board/etin/debris/debris.c
deleted file mode 100644 (file)
index 0308fef..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * (C) Copyright 2000
- * Sangmoon Kim, Etin Systems. dogoil@etinsys.com.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc824x.h>
-#include <net.h>
-#include <pci.h>
-#include <i2c.h>
-#include <netdev.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int checkboard (void)
-{
-       /*TODO: Check processor type */
-
-       puts (  "Board: Debris "
-#ifdef CONFIG_MPC8240
-               "8240"
-#endif
-#ifdef CONFIG_MPC8245
-               "8245"
-#endif
-               " ##Test not implemented yet##\n");
-       return 0;
-}
-
-#if 0  /* NOT USED */
-int checkflash (void)
-{
-       /* TODO: XXX XXX XXX */
-       printf ("## Test not implemented yet ##\n");
-
-       return (0);
-}
-#endif
-
-phys_size_t initdram (int board_type)
-{
-       int m, row, col, bank, i;
-       unsigned long start, end;
-       uint32_t mccr1;
-       uint32_t mear1 = 0, emear1 = 0, msar1 = 0, emsar1 = 0;
-       uint32_t mear2 = 0, emear2 = 0, msar2 = 0, emsar2 = 0;
-       uint8_t mber = 0;
-
-       i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-
-       if (i2c_reg_read (0x50, 2) != 0x04) return 0;   /* Memory type */
-       m = i2c_reg_read (0x50, 5);     /* # of physical banks */
-       row = i2c_reg_read (0x50, 3);   /* # of rows */
-       col = i2c_reg_read (0x50, 4);   /* # of columns */
-       bank = i2c_reg_read (0x50, 17); /* # of logical banks */
-
-       CONFIG_READ_WORD(MCCR1, mccr1);
-       mccr1 &= 0xffff0000;
-
-       start = CONFIG_SYS_SDRAM_BASE;
-       end = start + (1 << (col + row + 3) ) * bank - 1;
-
-       for (i = 0; i < m; i++) {
-               mccr1 |= ((row == 13)? 2 : (bank == 4)? 0 : 3) << i * 2;
-               if (i < 4) {
-                       msar1  |= ((start >> 20) & 0xff) << i * 8;
-                       emsar1 |= ((start >> 28) & 0xff) << i * 8;
-                       mear1  |= ((end >> 20) & 0xff) << i * 8;
-                       emear1 |= ((end >> 28) & 0xff) << i * 8;
-               } else {
-                       msar2  |= ((start >> 20) & 0xff) << (i-4) * 8;
-                       emsar2 |= ((start >> 28) & 0xff) << (i-4) * 8;
-                       mear2  |= ((end >> 20) & 0xff) << (i-4) * 8;
-                       emear2 |= ((end >> 28) & 0xff) << (i-4) * 8;
-               }
-               mber |= 1 << i;
-               start += (1 << (col + row + 3) ) * bank;
-               end += (1 << (col + row + 3) ) * bank;
-       }
-       for (; i < 8; i++) {
-               if (i < 4) {
-                       msar1  |= 0xff << i * 8;
-                       emsar1 |= 0x30 << i * 8;
-                       mear1  |= 0xff << i * 8;
-                       emear1 |= 0x30 << i * 8;
-               } else {
-                       msar2  |= 0xff << (i-4) * 8;
-                       emsar2 |= 0x30 << (i-4) * 8;
-                       mear2  |= 0xff << (i-4) * 8;
-                       emear2 |= 0x30 << (i-4) * 8;
-               }
-       }
-
-       CONFIG_WRITE_WORD(MCCR1, mccr1);
-       CONFIG_WRITE_WORD(MSAR1, msar1);
-       CONFIG_WRITE_WORD(EMSAR1, emsar1);
-       CONFIG_WRITE_WORD(MEAR1, mear1);
-       CONFIG_WRITE_WORD(EMEAR1, emear1);
-       CONFIG_WRITE_WORD(MSAR2, msar2);
-       CONFIG_WRITE_WORD(EMSAR2, emsar2);
-       CONFIG_WRITE_WORD(MEAR2, mear2);
-       CONFIG_WRITE_WORD(EMEAR2, emear2);
-       CONFIG_WRITE_BYTE(MBER, mber);
-
-       return (1 << (col + row + 3) ) * bank * m;
-}
-
-/*
- * Initialize PCI Devices, report devices found.
- */
-#ifndef CONFIG_PCI_PNP
-static struct pci_config_table pci_debris_config_table[] = {
-       { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
-         pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
-                                      PCI_ENET0_MEMADDR,
-                                      PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
-       { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
-         pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
-                                      PCI_ENET1_MEMADDR,
-                                      PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
-       { }
-};
-#endif
-
-struct pci_controller hose = {
-#ifndef CONFIG_PCI_PNP
-       config_table: pci_debris_config_table,
-#endif
-};
-
-void pci_init_board(void)
-{
-       pci_mpc824x_init(&hose);
-}
-
-void *nvram_read(void *dest, const long src, size_t count)
-{
-       volatile uchar *d = (volatile uchar*) dest;
-       volatile uchar *s = (volatile uchar*) src;
-       while(count--) {
-               *d++ = *s++;
-               asm volatile("sync");
-       }
-       return dest;
-}
-
-void nvram_write(long dest, const void *src, size_t count)
-{
-       volatile uchar *d = (volatile uchar*)dest;
-       volatile uchar *s = (volatile uchar*)src;
-       while(count--) {
-               *d++ = *s++;
-               asm volatile("sync");
-       }
-}
-
-int misc_init_r(void)
-{
-       uchar ethaddr[6];
-
-       if (eth_getenv_enetaddr("ethaddr", ethaddr))
-               /* Write ethernet addr in NVRAM for VxWorks */
-               nvram_write(CONFIG_ENV_ADDR + CONFIG_SYS_NVRAM_VXWORKS_OFFS,
-                               ethaddr, 6);
-
-       return 0;
-}
-
-int board_eth_init(bd_t *bis)
-{
-       return pci_eth_init(bis);
-}
diff --git a/board/etin/debris/flash.c b/board/etin/debris/flash.c
deleted file mode 100644 (file)
index 2657958..0000000
+++ /dev/null
@@ -1,705 +0,0 @@
-/*
- * board/eva/flash.c
- *
- * (C) Copyright 2002
- * Sangmoon Kim, Etin Systems, dogoil@etinsys.com.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/processor.h>
-#include <asm/pci_io.h>
-#include <mpc824x.h>
-#include <asm/mmu.h>
-
-int (*do_flash_erase)(flash_info_t*, uint32_t, uint32_t);
-int (*write_dword)(flash_info_t*, ulong, uint64_t);
-
-typedef uint64_t cfi_word;
-
-#define cfi_read(flash, addr) *((volatile cfi_word*)(flash->start[0] + addr))
-
-#define cfi_write(flash, val, addr) \
-       move64((cfi_word*)&val, \
-                       (cfi_word*)(flash->start[0] + addr))
-
-#define CMD(x) ((((cfi_word)x)<<48)|(((cfi_word)x)<<32)|(((cfi_word)x)<<16)|(((cfi_word)x)))
-
-static void write32(unsigned long addr, uint32_t value)
-{
-       *(volatile uint32_t*)(addr) = value;
-       asm volatile("sync");
-}
-
-static uint32_t read32(unsigned long addr)
-{
-       uint32_t value;
-       value = *(volatile uint32_t*)addr;
-       asm volatile("sync");
-       return value;
-}
-
-static cfi_word cfi_cmd(flash_info_t *flash, uint8_t cmd, uint32_t addr)
-{
-       uint32_t base = flash->start[0];
-       uint32_t val=(cmd << 16) | cmd;
-       addr <<= 3;
-       write32(base + addr, val);
-       return addr;
-}
-
-static uint16_t cfi_read_query(flash_info_t *flash, uint32_t addr)
-{
-       uint32_t base = flash->start[0];
-       addr <<= 3;
-       return (uint16_t)read32(base + addr);
-}
-
-flash_info_t    flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
-
-static void move64(uint64_t *src, uint64_t *dest)
-{
-       asm volatile("lfd  0, 0(3)\n\t" /* fpr0   =  *scr       */
-        "stfd 0, 0(4)"         /* *dest  =  fpr0       */
-        : : : "fr0" );         /* Clobbers fr0         */
-       return;
-}
-
-static int cfi_write_dword(flash_info_t *flash, ulong dest, cfi_word data)
-{
-       unsigned long start;
-       cfi_word status = 0;
-
-       status = cfi_read(flash, dest);
-       data &= status;
-
-       cfi_cmd(flash, 0x40, 0);
-       cfi_write(flash, data, dest);
-
-       udelay(10);
-       start = get_timer (0);
-       for(;;) {
-               status = cfi_read(flash, dest);
-               status &= CMD(0x80);
-               if(status == CMD(0x80))
-                       break;
-               if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
-                       cfi_cmd(flash, 0xff, 0);
-                       return 1;
-               }
-               udelay(1);
-       }
-       cfi_cmd(flash, 0xff, 0);
-
-       return 0;
-}
-
-static int jedec_write_dword (flash_info_t *flash, ulong dest, cfi_word data)
-{
-       ulong start;
-       cfi_word status = 0;
-
-       status = cfi_read(flash, dest);
-       if(status != CMD(0xffff)) return 2;
-
-       cfi_cmd(flash, 0xaa, 0x555);
-       cfi_cmd(flash, 0x55, 0x2aa);
-       cfi_cmd(flash, 0xa0, 0x555);
-
-       cfi_write(flash, data, dest);
-
-       udelay(10);
-       start = get_timer (0);
-       status = ~data;
-       while(status != data) {
-               if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT)
-                       return 1;
-               status = cfi_read(flash, dest);
-               udelay(1);
-       }
-       return 0;
-}
-
-static __inline__ unsigned long get_msr(void)
-{
-       unsigned long msr;
-       __asm__ __volatile__ ("mfmsr %0" : "=r" (msr) :);
-       return msr;
-}
-
-static __inline__ void set_msr(unsigned long msr)
-{
-       __asm__ __volatile__ ("mtmsr %0" : : "r" (msr));
-}
-
-int write_buff (flash_info_t *flash, uchar *src, ulong addr, ulong cnt)
-{
-       ulong wp;
-       int i, s, l, rc;
-       cfi_word data;
-       uint8_t *t = (uint8_t*)&data;
-       unsigned long base = flash->start[0];
-       uint32_t msr;
-
-       if (flash->flash_id == FLASH_UNKNOWN)
-               return 4;
-
-       if (cnt == 0)
-               return 0;
-
-       addr -= base;
-
-       msr = get_msr();
-       set_msr(msr|MSR_FP);
-
-       wp = (addr & ~7);   /* get lower word aligned address */
-
-       if((addr-wp) != 0) {
-               data = cfi_read(flash, wp);
-               s = addr & 7;
-               l = ( cnt < (8-s) ) ? cnt : (8-s);
-               for(i = 0; i < l; i++)
-                       t[s+i] = *src++;
-               if ((rc = write_dword(flash, wp, data)) != 0)
-                       goto DONE;
-               wp += 8;
-               cnt -= l;
-       }
-
-       while (cnt >= 8) {
-               for (i = 0; i < 8; i++)
-                       t[i] = *src++;
-               if ((rc = write_dword(flash, wp, data)) != 0)
-                       goto DONE;
-               wp  += 8;
-               cnt -= 8;
-       }
-
-       if (cnt == 0) {
-               rc = 0;
-               goto DONE;
-       }
-
-       data = cfi_read(flash, wp);
-       for(i = 0; i < cnt; i++)
-               t[i] = *src++;
-       rc = write_dword(flash, wp, data);
-DONE:
-       set_msr(msr);
-       return rc;
-}
-
-static int cfi_erase_oneblock(flash_info_t *flash, uint32_t sect)
-{
-       int sa;
-       int flag;
-       ulong start, last, now;
-       cfi_word status;
-
-       flag = disable_interrupts();
-
-       sa = (flash->start[sect] - flash->start[0]);
-       write32(flash->start[sect], 0x00200020);
-       write32(flash->start[sect], 0x00d000d0);
-
-       if (flag)
-               enable_interrupts();
-
-       udelay(1000);
-       start = get_timer (0);
-       last  = start;
-
-       for (;;) {
-               status = cfi_read(flash, sa);
-               status &= CMD(0x80);
-               if (status == CMD(0x80))
-                       break;
-               if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
-                       cfi_cmd(flash, 0xff, 0);
-                       printf ("Timeout\n");
-                       return ERR_TIMOUT;
-               }
-
-               if ((now - last) > 1000) {
-                       serial_putc ('.');
-                       last = now;
-               }
-               udelay(10);
-       }
-       cfi_cmd(flash, 0xff, 0);
-       return ERR_OK;
-}
-
-static int cfi_erase(flash_info_t *flash, uint32_t s_first, uint32_t s_last)
-{
-       int sect;
-       int rc = ERR_OK;
-
-       for (sect = s_first; sect <= s_last; sect++) {
-               if (flash->protect[sect] == 0) {
-                       rc = cfi_erase_oneblock(flash, sect);
-                       if (rc != ERR_OK) break;
-               }
-       }
-       printf (" done\n");
-       return rc;
-}
-
-static int jedec_erase(flash_info_t *flash, uint32_t s_first, uint32_t s_last)
-{
-       int sect;
-       cfi_word status;
-       int sa = -1;
-       int flag;
-       ulong start, last, now;
-
-       flag = disable_interrupts();
-
-       cfi_cmd(flash, 0xaa, 0x555);
-       cfi_cmd(flash, 0x55, 0x2aa);
-       cfi_cmd(flash, 0x80, 0x555);
-       cfi_cmd(flash, 0xaa, 0x555);
-       cfi_cmd(flash, 0x55, 0x2aa);
-       for ( sect = s_first; sect <= s_last; sect++) {
-               if (flash->protect[sect] == 0) {
-                       sa = flash->start[sect] - flash->start[0];
-                       write32(flash->start[sect], 0x00300030);
-               }
-       }
-       if (flag)
-               enable_interrupts();
-
-       if (sa < 0)
-               goto DONE;
-
-       udelay (1000);
-       start = get_timer (0);
-       last  = start;
-       for(;;) {
-               status = cfi_read(flash, sa);
-               if (status == CMD(0xffff))
-                       break;
-
-               if ((now = get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
-                       printf ("Timeout\n");
-                       return ERR_TIMOUT;
-               }
-
-               if ((now - last) > 1000) {
-                       serial_putc ('.');
-                       last = now;
-               }
-               udelay(10);
-       }
-DONE:
-       cfi_cmd(flash, 0xf0, 0);
-
-       printf (" done\n");
-
-       return ERR_OK;
-}
-
-int flash_erase (flash_info_t *flash, int s_first, int s_last)
-{
-       int sect;
-       int prot;
-
-       if ((s_first < 0) || (s_first > s_last)) {
-               if (flash->flash_id == FLASH_UNKNOWN)
-                       printf ("- missing\n");
-               else
-                       printf ("- no sectors to erase\n");
-               return ERR_NOT_ERASED;
-       }
-       if (flash->flash_id == FLASH_UNKNOWN) {
-               printf ("Can't erase unknown flash type - aborted\n");
-               return ERR_NOT_ERASED;
-       }
-
-       prot = 0;
-       for (sect = s_first; sect <= s_last; sect++)
-               if (flash->protect[sect]) prot++;
-
-       if (prot)
-               printf ("- Warning: %d protected sectors will not be erased!\n",
-                                                               prot);
-       else
-               printf ("\n");
-
-       return do_flash_erase(flash, s_first, s_last);
-}
-
-struct jedec_flash_info {
-       const uint16_t mfr_id;
-       const uint16_t dev_id;
-       const char *name;
-       const int DevSize;
-       const int InterfaceDesc;
-       const int NumEraseRegions;
-       const ulong regions[4];
-};
-
-#define ERASEINFO(size,blocks) (size<<8)|(blocks-1)
-
-#define SIZE_1MiB 20
-#define SIZE_2MiB 21
-#define SIZE_4MiB 22
-
-static const struct jedec_flash_info jedec_table[] = {
-       {
-               mfr_id: (uint16_t)AMD_MANUFACT,
-               dev_id: (uint16_t)AMD_ID_LV800T,
-               name: "AMD AM29LV800T",
-               DevSize: SIZE_1MiB,
-               NumEraseRegions: 4,
-               regions: {ERASEINFO(0x10000,15),
-                         ERASEINFO(0x08000,1),
-                         ERASEINFO(0x02000,2),
-                         ERASEINFO(0x04000,1)
-               }
-       }, {
-               mfr_id: (uint16_t)AMD_MANUFACT,
-               dev_id: (uint16_t)AMD_ID_LV800B,
-               name: "AMD AM29LV800B",
-               DevSize: SIZE_1MiB,
-               NumEraseRegions: 4,
-               regions: {ERASEINFO(0x10000,15),
-                         ERASEINFO(0x08000,1),
-                         ERASEINFO(0x02000,2),
-                         ERASEINFO(0x04000,1)
-               }
-       }, {
-               mfr_id: (uint16_t)AMD_MANUFACT,
-               dev_id: (uint16_t)AMD_ID_LV160T,
-               name: "AMD AM29LV160T",
-               DevSize: SIZE_2MiB,
-               NumEraseRegions: 4,
-               regions: {ERASEINFO(0x10000,31),
-                         ERASEINFO(0x08000,1),
-                         ERASEINFO(0x02000,2),
-                         ERASEINFO(0x04000,1)
-               }
-       }, {
-               mfr_id: (uint16_t)AMD_MANUFACT,
-               dev_id: (uint16_t)AMD_ID_LV160B,
-               name: "AMD AM29LV160B",
-               DevSize: SIZE_2MiB,
-               NumEraseRegions: 4,
-               regions: {ERASEINFO(0x04000,1),
-                         ERASEINFO(0x02000,2),
-                         ERASEINFO(0x08000,1),
-                         ERASEINFO(0x10000,31)
-               }
-       }, {
-               mfr_id: (uint16_t)AMD_MANUFACT,
-               dev_id: (uint16_t)AMD_ID_LV320T,
-               name: "AMD AM29LV320T",
-               DevSize: SIZE_4MiB,
-               NumEraseRegions: 2,
-               regions: {ERASEINFO(0x10000,63),
-                         ERASEINFO(0x02000,8)
-               }
-
-       }, {
-               mfr_id: (uint16_t)AMD_MANUFACT,
-               dev_id: (uint16_t)AMD_ID_LV320B,
-               name: "AMD AM29LV320B",
-               DevSize: SIZE_4MiB,
-               NumEraseRegions: 2,
-               regions: {ERASEINFO(0x02000,8),
-                         ERASEINFO(0x10000,63)
-               }
-       }
-};
-
-static ulong cfi_init(uint32_t base,  flash_info_t *flash)
-{
-       int sector;
-       int block;
-       int block_count;
-       int offset = 0;
-       int reverse = 0;
-       int primary;
-       int mfr_id;
-       int dev_id;
-
-       flash->start[0] = base;
-       cfi_cmd(flash, 0xF0, 0);
-       cfi_cmd(flash, 0x98, 0);
-       if ( !( cfi_read_query(flash, 0x10) == 'Q' &&
-               cfi_read_query(flash, 0x11) == 'R' &&
-               cfi_read_query(flash, 0x12) == 'Y' )) {
-               cfi_cmd(flash, 0xff, 0);
-               return 0;
-       }
-
-       flash->size = 1 << cfi_read_query(flash, 0x27);
-       flash->size *= 4;
-       block_count = cfi_read_query(flash, 0x2c);
-       primary = cfi_read_query(flash, 0x15);
-       if ( cfi_read_query(flash, primary + 4) == 0x30)
-               reverse = (cfi_read_query(flash, 0x1) & 0x01);
-       else
-               reverse = (cfi_read_query(flash, primary+15) == 3);
-
-       flash->sector_count = 0;
-
-       for ( block = reverse ? block_count - 1 : 0;
-                     reverse ? block >= 0      : block < block_count;
-                     reverse ? block--         : block ++) {
-               int sector_size =
-                       (cfi_read_query(flash, 0x2d + block*4+2) |
-                       (cfi_read_query(flash, 0x2d + block*4+3) << 8)) << 8;
-               int sector_count =
-                       (cfi_read_query(flash, 0x2d + block*4+0) |
-                       (cfi_read_query(flash, 0x2d + block*4+1) << 8)) + 1;
-               for(sector = 0; sector < sector_count; sector++) {
-                       flash->start[flash->sector_count++] = base + offset;
-                       offset += sector_size * 4;
-               }
-       }
-       mfr_id = cfi_read_query(flash, 0x00);
-       dev_id = cfi_read_query(flash, 0x01);
-
-       cfi_cmd(flash, 0xff, 0);
-
-       flash->flash_id = (mfr_id << 16) | dev_id;
-
-       for (sector = 0; sector < flash->sector_count; sector++) {
-               write32(flash->start[sector], 0x00600060);
-               write32(flash->start[sector], 0x00d000d0);
-       }
-       cfi_cmd(flash, 0xff, 0);
-
-       for (sector = 0; sector < flash->sector_count; sector++)
-               flash->protect[sector] = 0;
-
-       do_flash_erase = cfi_erase;
-       write_dword = cfi_write_dword;
-
-       return flash->size;
-}
-
-static ulong jedec_init(unsigned long base, flash_info_t *flash)
-{
-       int i;
-       int block, block_count;
-       int sector, offset;
-       int mfr_id, dev_id;
-       flash->start[0] = base;
-       cfi_cmd(flash, 0xF0, 0x000);
-       cfi_cmd(flash, 0xAA, 0x555);
-       cfi_cmd(flash, 0x55, 0x2AA);
-       cfi_cmd(flash, 0x90, 0x555);
-       mfr_id = cfi_read_query(flash, 0x000);
-       dev_id = cfi_read_query(flash, 0x0001);
-       cfi_cmd(flash, 0xf0, 0x000);
-
-       for(i=0; i<sizeof(jedec_table)/sizeof(struct jedec_flash_info); i++) {
-               if((jedec_table[i].mfr_id == mfr_id) &&
-                       (jedec_table[i].dev_id == dev_id)) {
-
-                       flash->flash_id = (mfr_id << 16) | dev_id;
-                       flash->size = 1 << jedec_table[0].DevSize;
-                       flash->size *= 4;
-                       block_count = jedec_table[i].NumEraseRegions;
-                       offset = 0;
-                       flash->sector_count = 0;
-                       for (block = 0; block < block_count; block++) {
-                               int sector_size = jedec_table[i].regions[block];
-                               int sector_count = (sector_size & 0xff) + 1;
-                               sector_size >>= 8;
-                               for (sector=0; sector<sector_count; sector++) {
-                                       flash->start[flash->sector_count++] =
-                                               base + offset;
-                                       offset += sector_size * 4;
-                               }
-                       }
-                       break;
-               }
-       }
-
-       for (sector = 0; sector < flash->sector_count; sector++)
-               flash->protect[sector] = 0;
-
-       do_flash_erase = jedec_erase;
-       write_dword = jedec_write_dword;
-
-       return flash->size;
-}
-
-inline void mtibat1u(unsigned int x)
-{
-       __asm__ __volatile__ ("mtspr   530, %0" :: "r" (x));
-}
-
-inline void mtibat1l(unsigned int x)
-{
-       __asm__ __volatile__ ("mtspr   531, %0" :: "r" (x));
-}
-
-inline void mtdbat1u(unsigned int x)
-{
-       __asm__ __volatile__ ("mtspr   538, %0" :: "r" (x));
-}
-
-inline void mtdbat1l(unsigned int x)
-{
-       __asm__ __volatile__ ("mtspr   539, %0" :: "r" (x));
-}
-
-unsigned long flash_init (void)
-{
-       unsigned long size = 0;
-       int i;
-       unsigned int msr;
-
-       /* BAT1 */
-       CONFIG_WRITE_WORD(ERCR3, 0x0C00000C);
-       CONFIG_WRITE_WORD(ERCR4, 0x0800000C);
-       msr = get_msr();
-       set_msr(msr & ~(MSR_IR | MSR_DR));
-       mtibat1l(0x70000000 | BATL_PP_10 | BATL_CACHEINHIBIT);
-       mtibat1u(0x70000000 | BATU_BL_256M | BATU_VS | BATU_VP);
-       mtdbat1l(0x70000000 | BATL_PP_10 | BATL_CACHEINHIBIT);
-       mtdbat1u(0x70000000 | BATU_BL_256M | BATU_VS | BATU_VP);
-       set_msr(msr);
-
-       for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++)
-               flash_info[i].flash_id = FLASH_UNKNOWN;
-       size = cfi_init(FLASH_BASE0_PRELIM, &flash_info[0]);
-       if (!size)
-               size = jedec_init(FLASH_BASE0_PRELIM, &flash_info[0]);
-
-       if (flash_info[0].flash_id == FLASH_UNKNOWN)
-               printf ("# Unknown FLASH on Bank 1 - Size = 0x%08lx = %ld MB\n",
-                       size, size<<20);
-
-       return size;
-}
-
-void flash_print_info  (flash_info_t *flash)
-{
-       int i;
-       int k;
-       int size;
-       int erased;
-       volatile unsigned long *p;
-
-       if (flash->flash_id == FLASH_UNKNOWN) {
-               printf ("missing or unknown FLASH type\n");
-               flash_init();
-       }
-
-       if (flash->flash_id == FLASH_UNKNOWN) {
-               printf ("missing or unknown FLASH type\n");
-               return;
-       }
-
-       switch (((flash->flash_id) >> 16) & 0xff) {
-       case 0x01:
-               printf ("AMD ");
-               break;
-       case 0x04:
-               printf("FUJITSU ");
-               break;
-       case 0x20:
-               printf("STM ");
-               break;
-       case 0xBF:
-               printf("SST ");
-               break;
-       case 0x89:
-       case 0xB0:
-               printf("INTEL ");
-               break;
-       default:
-               printf ("Unknown Vendor ");
-               break;
-       }
-
-       switch ((flash->flash_id) & 0xffff) {
-       case (uint16_t)AMD_ID_LV800T:
-               printf ("AM29LV800T\n");
-               break;
-       case (uint16_t)AMD_ID_LV800B:
-               printf ("AM29LV800B\n");
-               break;
-       case (uint16_t)AMD_ID_LV160T:
-               printf ("AM29LV160T\n");
-               break;
-       case (uint16_t)AMD_ID_LV160B:
-               printf ("AM29LV160B\n");
-               break;
-       case (uint16_t)AMD_ID_LV320T:
-               printf ("AM29LV320T\n");
-               break;
-       case (uint16_t)AMD_ID_LV320B:
-               printf ("AM29LV320B\n");
-               break;
-       case (uint16_t)INTEL_ID_28F800C3T:
-               printf ("28F800C3T\n");
-               break;
-       case (uint16_t)INTEL_ID_28F800C3B:
-               printf ("28F800C3B\n");
-               break;
-       case (uint16_t)INTEL_ID_28F160C3T:
-               printf ("28F160C3T\n");
-               break;
-       case (uint16_t)INTEL_ID_28F160C3B:
-               printf ("28F160C3B\n");
-               break;
-       case (uint16_t)INTEL_ID_28F320C3T:
-               printf ("28F320C3T\n");
-               break;
-       case (uint16_t)INTEL_ID_28F320C3B:
-               printf ("28F320C3B\n");
-               break;
-       case (uint16_t)INTEL_ID_28F640C3T:
-               printf ("28F640C3T\n");
-               break;
-       case (uint16_t)INTEL_ID_28F640C3B:
-               printf ("28F640C3B\n");
-               break;
-       default:
-               printf ("Unknown Chip Type\n");
-               break;
-       }
-
-       if (flash->size >= (1 << 20)) {
-               printf ("  Size: %ld MB in %d Sectors\n",
-                               flash->size >> 20, flash->sector_count);
-       } else {
-               printf ("  Size: %ld kB in %d Sectors\n",
-                               flash->size >> 10, flash->sector_count);
-       }
-
-       printf ("  Sector Start Addresses:");
-       for (i = 0; i < flash->sector_count; ++i) {
-               /* Check if whole sector is erased*/
-               if (i != (flash->sector_count-1))
-                       size = flash->start[i+1] - flash->start[i];
-               else
-                       size = flash->start[0] + flash->size - flash->start[i];
-
-               erased = 1;
-               p = (volatile unsigned long *)flash->start[i];
-               size = size >> 2;        /* divide by 4 for longword access */
-               for (k=0; k<size; k++) {
-                       if (*p++ != 0xffffffff) {
-                               erased = 0;
-                               break;
-                       }
-               }
-
-               if ((i % 5) == 0)
-                       printf ("\n   ");
-
-               printf (" %08lX%s%s",
-                       flash->start[i],
-                       erased ? " E" : "  ",
-                       flash->protect[i] ? "RO " : "   ");
-       }
-       printf ("\n");
-}
diff --git a/board/etin/debris/phantom.c b/board/etin/debris/phantom.c
deleted file mode 100644 (file)
index 3d5aa14..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * board/eva/phantom.c
- *
- * Phantom RTC device driver for EVA
- *
- * Author: Sangmoon Kim
- *         dogoil@etinsys.com
- *
- * Copyright 2002 Etinsys Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <command.h>
-#include <rtc.h>
-
-#if defined(CONFIG_CMD_DATE)
-
-#define RTC_BASE (CONFIG_SYS_NVRAM_BASE_ADDR + 0x7fff8)
-
-#define RTC_YEAR                ( RTC_BASE + 7 )
-#define RTC_MONTH               ( RTC_BASE + 6 )
-#define RTC_DAY_OF_MONTH        ( RTC_BASE + 5 )
-#define RTC_DAY_OF_WEEK         ( RTC_BASE + 4 )
-#define RTC_HOURS               ( RTC_BASE + 3 )
-#define RTC_MINUTES             ( RTC_BASE + 2 )
-#define RTC_SECONDS             ( RTC_BASE + 1 )
-#define RTC_CENTURY             ( RTC_BASE + 0 )
-
-#define RTC_CONTROLA            RTC_CENTURY
-#define RTC_CONTROLB            RTC_SECONDS
-#define RTC_CONTROLC            RTC_DAY_OF_WEEK
-
-#define RTC_CA_WRITE            0x80
-#define RTC_CA_READ             0x40
-
-#define RTC_CB_OSC_DISABLE      0x80
-
-#define RTC_CC_BATTERY_FLAG     0x80
-#define RTC_CC_FREQ_TEST        0x40
-
-
-static int phantom_flag = -1;
-static int century_flag = -1;
-
-static uchar rtc_read(unsigned int addr)
-{
-       return *(volatile unsigned char *)(addr);
-}
-
-static void rtc_write(unsigned int addr, uchar val)
-{
-       *(volatile unsigned char *)(addr) = val;
-}
-
-static unsigned char phantom_rtc_sequence[] = {
-       0xc5, 0x3a, 0xa3, 0x5c, 0xc5, 0x3a, 0xa3, 0x5c
-};
-
-static unsigned char* phantom_rtc_read(int addr, unsigned char rtc[8])
-{
-       int i, j;
-       unsigned char v;
-       unsigned char save = rtc_read(addr);
-
-       for (j = 0; j < 8; j++) {
-               v = phantom_rtc_sequence[j];
-               for (i = 0; i < 8; i++) {
-                       rtc_write(addr, v & 1);
-                       v >>= 1;
-               }
-       }
-       for (j = 0; j < 8; j++) {
-               v = 0;
-               for (i = 0; i < 8; i++) {
-                       if(rtc_read(addr) & 1)
-                               v |= 1 << i;
-               }
-               rtc[j] = v;
-       }
-       rtc_write(addr, save);
-       return rtc;
-}
-
-static void phantom_rtc_write(int addr, unsigned char rtc[8])
-{
-       int i, j;
-       unsigned char v;
-       unsigned char save = rtc_read(addr);
-       for (j = 0; j < 8; j++) {
-               v = phantom_rtc_sequence[j];
-               for (i = 0; i < 8; i++) {
-                       rtc_write(addr, v & 1);
-                       v >>= 1;
-               }
-       }
-       for (j = 0; j < 8; j++) {
-               v = rtc[j];
-               for (i = 0; i < 8; i++) {
-                       rtc_write(addr, v & 1);
-                       v >>= 1;
-               }
-       }
-       rtc_write(addr, save);
-}
-
-static int get_phantom_flag(void)
-{
-       int i;
-       unsigned char rtc[8];
-
-       phantom_rtc_read(RTC_BASE, rtc);
-
-       for(i = 1; i < 8; i++) {
-               if (rtc[i] != rtc[0])
-                       return 1;
-       }
-       return 0;
-}
-
-void rtc_reset(void)
-{
-       if (phantom_flag < 0)
-               phantom_flag = get_phantom_flag();
-
-       if (phantom_flag) {
-               unsigned char rtc[8];
-               phantom_rtc_read(RTC_BASE, rtc);
-               if(rtc[4] & 0x30) {
-                       printf( "real-time-clock was stopped. Now starting...\n" );
-                       rtc[4] &= 0x07;
-                       phantom_rtc_write(RTC_BASE, rtc);
-               }
-       } else {
-               uchar reg_a, reg_b, reg_c;
-               reg_a = rtc_read( RTC_CONTROLA );
-               reg_b = rtc_read( RTC_CONTROLB );
-
-               if ( reg_b & RTC_CB_OSC_DISABLE )
-               {
-                       printf( "real-time-clock was stopped. Now starting...\n" );
-                       reg_a |= RTC_CA_WRITE;
-                       reg_b &= ~RTC_CB_OSC_DISABLE;
-                       rtc_write( RTC_CONTROLA, reg_a );
-                       rtc_write( RTC_CONTROLB, reg_b );
-               }
-
-               /* make sure read/write clock register bits are cleared */
-               reg_a &= ~( RTC_CA_WRITE | RTC_CA_READ );
-               rtc_write( RTC_CONTROLA, reg_a );
-
-               reg_c = rtc_read( RTC_CONTROLC );
-               if (( reg_c & RTC_CC_BATTERY_FLAG ) == 0 )
-                       printf( "RTC battery low. Clock setting may not be reliable.\n");
-       }
-}
-
-static int get_century_flag(void)
-{
-       int flag = 0;
-       int bcd, century;
-       bcd = rtc_read( RTC_CENTURY );
-       century = bcd2bin( bcd & 0x3F );
-       rtc_write( RTC_CENTURY, bin2bcd(century+1));
-       if (bcd == rtc_read( RTC_CENTURY ))
-               flag = 1;
-       rtc_write( RTC_CENTURY, bcd);
-       return flag;
-}
-
-int rtc_get( struct rtc_time *tmp)
-{
-       if (phantom_flag < 0)
-               phantom_flag = get_phantom_flag();
-
-       if (phantom_flag)
-       {
-               unsigned char rtc[8];
-
-               phantom_rtc_read(RTC_BASE, rtc);
-
-               tmp->tm_sec     = bcd2bin(rtc[1] & 0x7f);
-               tmp->tm_min     = bcd2bin(rtc[2] & 0x7f);
-               tmp->tm_hour    = bcd2bin(rtc[3] & 0x1f);
-               tmp->tm_wday    = bcd2bin(rtc[4] & 0x7);
-               tmp->tm_mday    = bcd2bin(rtc[5] & 0x3f);
-               tmp->tm_mon     = bcd2bin(rtc[6] & 0x1f);
-               tmp->tm_year    = bcd2bin(rtc[7]) + 1900;
-               tmp->tm_yday = 0;
-               tmp->tm_isdst = 0;
-
-               if( (rtc[3] & 0x80)  && (rtc[3] & 0x40) ) tmp->tm_hour += 12;
-               if (tmp->tm_year < 1970) tmp->tm_year += 100;
-       } else {
-               uchar sec, min, hour;
-               uchar mday, wday, mon, year;
-
-               int century;
-
-               uchar reg_a;
-
-               if (century_flag < 0)
-                       century_flag = get_century_flag();
-
-               reg_a = rtc_read( RTC_CONTROLA );
-               /* lock clock registers for read */
-               rtc_write( RTC_CONTROLA, ( reg_a | RTC_CA_READ ));
-
-               sec     = rtc_read( RTC_SECONDS );
-               min     = rtc_read( RTC_MINUTES );
-               hour    = rtc_read( RTC_HOURS );
-               mday    = rtc_read( RTC_DAY_OF_MONTH );
-               wday    = rtc_read( RTC_DAY_OF_WEEK );
-               mon     = rtc_read( RTC_MONTH );
-               year    = rtc_read( RTC_YEAR );
-               century = rtc_read( RTC_CENTURY );
-
-               /* unlock clock registers after read */
-               rtc_write( RTC_CONTROLA, ( reg_a & ~RTC_CA_READ ));
-
-               tmp->tm_sec  = bcd2bin( sec  & 0x7F );
-               tmp->tm_min  = bcd2bin( min  & 0x7F );
-               tmp->tm_hour = bcd2bin( hour & 0x3F );
-               tmp->tm_mday = bcd2bin( mday & 0x3F );
-               tmp->tm_mon  = bcd2bin( mon & 0x1F );
-               tmp->tm_wday = bcd2bin( wday & 0x07 );
-
-               if (century_flag) {
-                       tmp->tm_year = bcd2bin( year ) +
-                               ( bcd2bin( century & 0x3F ) * 100 );
-               } else {
-                       tmp->tm_year = bcd2bin( year ) + 1900;
-                       if (tmp->tm_year < 1970) tmp->tm_year += 100;
-               }
-
-               tmp->tm_yday = 0;
-               tmp->tm_isdst= 0;
-       }
-
-       return 0;
-}
-
-int rtc_set( struct rtc_time *tmp )
-{
-       if (phantom_flag < 0)
-               phantom_flag = get_phantom_flag();
-
-       if (phantom_flag) {
-               uint year;
-               unsigned char rtc[8];
-
-               year = tmp->tm_year;
-               year -= (year < 2000) ? 1900 : 2000;
-
-               rtc[0] = bin2bcd(0);
-               rtc[1] = bin2bcd(tmp->tm_sec);
-               rtc[2] = bin2bcd(tmp->tm_min);
-               rtc[3] = bin2bcd(tmp->tm_hour);
-               rtc[4] = bin2bcd(tmp->tm_wday);
-               rtc[5] = bin2bcd(tmp->tm_mday);
-               rtc[6] = bin2bcd(tmp->tm_mon);
-               rtc[7] = bin2bcd(year);
-
-               phantom_rtc_write(RTC_BASE, rtc);
-       } else {
-               uchar reg_a;
-               if (century_flag < 0)
-                       century_flag = get_century_flag();
-
-               /* lock clock registers for write */
-               reg_a = rtc_read( RTC_CONTROLA );
-               rtc_write( RTC_CONTROLA, ( reg_a | RTC_CA_WRITE ));
-
-               rtc_write( RTC_MONTH, bin2bcd( tmp->tm_mon ));
-
-               rtc_write( RTC_DAY_OF_WEEK, bin2bcd( tmp->tm_wday ));
-               rtc_write( RTC_DAY_OF_MONTH, bin2bcd( tmp->tm_mday ));
-               rtc_write( RTC_HOURS, bin2bcd( tmp->tm_hour ));
-               rtc_write( RTC_MINUTES, bin2bcd( tmp->tm_min ));
-               rtc_write( RTC_SECONDS, bin2bcd( tmp->tm_sec ));
-
-               /* break year up into century and year in century */
-               if (century_flag) {
-                       rtc_write( RTC_YEAR, bin2bcd( tmp->tm_year % 100 ));
-                       rtc_write( RTC_CENTURY, bin2bcd( tmp->tm_year / 100 ));
-                       reg_a &= 0xc0;
-                       reg_a |= bin2bcd( tmp->tm_year / 100 );
-               } else {
-                       rtc_write(RTC_YEAR, bin2bcd(tmp->tm_year -
-                               ((tmp->tm_year < 2000) ? 1900 : 2000)));
-               }
-
-               /* unlock clock registers after read */
-               rtc_write( RTC_CONTROLA, ( reg_a  & ~RTC_CA_WRITE ));
-       }
-
-       return 0;
-}
-
-#endif
diff --git a/board/etin/kvme080/Makefile b/board/etin/kvme080/Makefile
deleted file mode 100644 (file)
index d1b6f30..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  = kvme080.o multiverse.o
diff --git a/board/etin/kvme080/kvme080.c b/board/etin/kvme080/kvme080.c
deleted file mode 100644 (file)
index baf4cbc..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * (C) Copyright 2005
- * Sangmoon Kim, Etin Systems. dogoil@etinsys.com.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc824x.h>
-#include <pci.h>
-#include <i2c.h>
-#include <netdev.h>
-#include <asm/processor.h>
-#include <asm/mmu.h>
-
-int checkboard(void)
-{
-       puts ("Board: KVME080\n");
-       return 0;
-}
-
-unsigned long setdram(int m, int row, int col, int bank)
-{
-       int i;
-       unsigned long start, end;
-       uint32_t mccr1;
-       uint32_t mear1 = 0, emear1 = 0, msar1 = 0, emsar1 = 0;
-       uint32_t mear2 = 0, emear2 = 0, msar2 = 0, emsar2 = 0;
-       uint8_t mber = 0;
-
-       CONFIG_READ_WORD(MCCR1, mccr1);
-       mccr1 &= 0xffff0000;
-
-       start = CONFIG_SYS_SDRAM_BASE;
-       end = start + (1 << (col + row + 3) ) * bank - 1;
-
-       for (i = 0; i < m; i++) {
-               mccr1 |= ((row == 13)? 2 : (bank == 4)? 0 : 3) << i * 2;
-               if (i < 4) {
-                       msar1  |= ((start >> 20) & 0xff) << i * 8;
-                       emsar1 |= ((start >> 28) & 0xff) << i * 8;
-                       mear1  |= ((end >> 20) & 0xff) << i * 8;
-                       emear1 |= ((end >> 28) & 0xff) << i * 8;
-               } else {
-                       msar2  |= ((start >> 20) & 0xff) << (i-4) * 8;
-                       emsar2 |= ((start >> 28) & 0xff) << (i-4) * 8;
-                       mear2  |= ((end >> 20) & 0xff) << (i-4) * 8;
-                       emear2 |= ((end >> 28) & 0xff) << (i-4) * 8;
-               }
-               mber |= 1 << i;
-               start += (1 << (col + row + 3) ) * bank;
-               end += (1 << (col + row + 3) ) * bank;
-       }
-       for (; i < 8; i++) {
-               if (i < 4) {
-                       msar1  |= 0xff << i * 8;
-                       emsar1 |= 0x30 << i * 8;
-                       mear1  |= 0xff << i * 8;
-                       emear1 |= 0x30 << i * 8;
-               } else {
-                       msar2  |= 0xff << (i-4) * 8;
-                       emsar2 |= 0x30 << (i-4) * 8;
-                       mear2  |= 0xff << (i-4) * 8;
-                       emear2 |= 0x30 << (i-4) * 8;
-               }
-       }
-
-       CONFIG_WRITE_WORD(MCCR1, mccr1);
-       CONFIG_WRITE_WORD(MSAR1, msar1);
-       CONFIG_WRITE_WORD(EMSAR1, emsar1);
-       CONFIG_WRITE_WORD(MEAR1, mear1);
-       CONFIG_WRITE_WORD(EMEAR1, emear1);
-       CONFIG_WRITE_WORD(MSAR2, msar2);
-       CONFIG_WRITE_WORD(EMSAR2, emsar2);
-       CONFIG_WRITE_WORD(MEAR2, mear2);
-       CONFIG_WRITE_WORD(EMEAR2, emear2);
-       CONFIG_WRITE_BYTE(MBER, mber);
-
-       return (1 << (col + row + 3) ) * bank * m;
-}
-
-phys_size_t initdram(int board_type)
-{
-       unsigned int msr;
-       long int size = 0;
-
-       msr = mfmsr();
-       mtmsr(msr & ~(MSR_IR | MSR_DR));
-       mtspr(IBAT2L, CONFIG_SYS_IBAT0L + 0x10000000);
-       mtspr(IBAT2U, CONFIG_SYS_IBAT0U + 0x10000000);
-       mtspr(DBAT2L, CONFIG_SYS_DBAT0L + 0x10000000);
-       mtspr(DBAT2U, CONFIG_SYS_DBAT0U + 0x10000000);
-       mtmsr(msr);
-
-       if (setdram(2,13,10,4) == get_ram_size(CONFIG_SYS_SDRAM_BASE, 0x20000000))
-               size = 0x20000000;      /* 512MB */
-       else if (setdram(1,13,10,4) == get_ram_size(CONFIG_SYS_SDRAM_BASE, 0x10000000))
-               size = 0x10000000;      /* 256MB */
-       else if (setdram(2,13,9,4) == get_ram_size(CONFIG_SYS_SDRAM_BASE, 0x10000000))
-               size = 0x10000000;      /* 256MB */
-       else if (setdram(1,13,9,4) == get_ram_size(CONFIG_SYS_SDRAM_BASE, 0x08000000))
-               size = 0x08000000;      /* 128MB */
-       else if (setdram(2,12,9,4) == get_ram_size(CONFIG_SYS_SDRAM_BASE, 0x08000000))
-               size = 0x08000000;      /* 128MB */
-       else if (setdram(1,12,9,4) == get_ram_size(CONFIG_SYS_SDRAM_BASE, 0x04000000))
-               size = 0x04000000;      /* 64MB */
-
-       msr = mfmsr();
-       mtmsr(msr & ~(MSR_IR | MSR_DR));
-       mtspr(IBAT2L, CONFIG_SYS_IBAT2L);
-       mtspr(IBAT2U, CONFIG_SYS_IBAT2U);
-       mtspr(DBAT2L, CONFIG_SYS_DBAT2L);
-       mtspr(DBAT2U, CONFIG_SYS_DBAT2U);
-       mtmsr(msr);
-
-       return size;
-}
-
-struct pci_controller hose;
-
-void pci_init_board(void)
-{
-       pci_mpc824x_init(&hose);
-}
-
-int board_early_init_f(void)
-{
-       *(volatile unsigned char *)(0xff080120) = 0xfb;
-
-       return 0;
-}
-
-int board_early_init_r(void)
-{
-       unsigned int msr;
-
-       CONFIG_WRITE_WORD(ERCR1, 0x95ff8000);
-       CONFIG_WRITE_WORD(ERCR3, 0x0c00000e);
-       CONFIG_WRITE_WORD(ERCR4, 0x0800000e);
-
-       msr = mfmsr();
-       mtmsr(msr & ~(MSR_IR | MSR_DR));
-       mtspr(IBAT1L, 0x70000000 | BATL_PP_10 | BATL_CACHEINHIBIT);
-       mtspr(IBAT1U, 0x70000000 | BATU_BL_256M | BATU_VS | BATU_VP);
-       mtspr(DBAT1L, 0x70000000 | BATL_PP_10 | BATL_CACHEINHIBIT);
-       mtspr(DBAT1U, 0x70000000 | BATU_BL_256M | BATU_VS | BATU_VP);
-       mtmsr(msr);
-
-       return 0;
-}
-
-extern int multiverse_init(void);
-
-int misc_init_r(void)
-{
-       multiverse_init();
-       return 0;
-}
-
-void *nvram_read(void *dest, const long src, size_t count)
-{
-       volatile uchar *d = (volatile uchar*) dest;
-       volatile uchar *s = (volatile uchar*) src;
-       while(count--) {
-               *d++ = *s++;
-               asm volatile("sync");
-       }
-       return dest;
-}
-
-void nvram_write(long dest, const void *src, size_t count)
-{
-       volatile uchar *d = (volatile uchar*)dest;
-       volatile uchar *s = (volatile uchar*)src;
-       while(count--) {
-               *d++ = *s++;
-               asm volatile("sync");
-       }
-}
-
-int board_eth_init(bd_t *bis)
-{
-       return pci_eth_init(bis);
-}
diff --git a/board/etin/kvme080/multiverse.c b/board/etin/kvme080/multiverse.c
deleted file mode 100644 (file)
index 2bcfe2e..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * multiverse.c
- *
- * VME driver for Multiverse
- *
- * Author : Sangmoon Kim
- *         dogoil@etinsys.com
- *
- * Copyright 2005 ETIN SYSTEMS Co.,Ltd.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <pci.h>
-#include <linux/compiler.h>
-
-#include "multiverse.h"
-
-static unsigned long vme_asi_addr;
-static unsigned long vme_iack_addr;
-static unsigned long pci_reg_addr;
-static unsigned long vme_reg_addr;
-
-int multiv_reset(unsigned long base)
-{
-       writeb(0x09, base + VME_SLAVE32_AM);
-       writeb(0x39, base + VME_SLAVE24_AM);
-       writeb(0x29, base + VME_SLAVE16_AM);
-       writeb(0x2f, base + VME_SLAVE_REG_AM);
-       writeb((VME_A32_SLV_BUS >> 24) & 0xff, base + VME_SLAVE32_A);
-       writeb((VME_A24_SLV_BUS >> 16) & 0xff, base + VME_SLAVE24_A);
-       writeb((VME_A16_SLV_BUS >> 8 ) & 0xff, base + VME_SLAVE16_A);
-#ifdef A32_SLV_WINDOW
-       if (readb(base + VME_STATUS) & VME_STATUS_SYSCON) {
-               writeb(((~(VME_A32_SLV_SIZE-1)) >> 24) & 0xff,
-                               base + VME_SLAVE32_MASK);
-               writeb(0x01, base + VME_SLAVE32_EN);
-       } else {
-               writeb(0xff, base + VME_SLAVE32_MASK);
-               writeb(0x00, base + VME_SLAVE32_EN);
-       }
-#else
-       writeb(0xff, base + VME_SLAVE32_MASK);
-       writeb(0x00, base + VME_SLAVE32_EN);
-#endif
-#ifdef A24_SLV_WINDOW
-       if (readb(base + VME_STATUS) & VME_STATUS_SYSCON) {
-               writeb(((~(VME_A24_SLV_SIZE-1)) >> 16) & 0xff,
-                               base + VME_SLAVE24_MASK);
-               writeb(0x01, base + VME_SLAVE24_EN);
-       } else {
-               writeb(0xff, base + VME_SLAVE24_MASK);
-               writeb(0x00, base + VME_SLAVE24_EN);
-       }
-#else
-       writeb(0xff, base + VME_SLAVE24_MASK);
-       writeb(0x00, base + VME_SLAVE24_EN);
-#endif
-#ifdef A16_SLV_WINDOW
-       if (readb(base + VME_STATUS) & VME_STATUS_SYSCON) {
-               writeb(((~(VME_A16_SLV_SIZE-1)) >> 8) & 0xff,
-                               base + VME_SLAVE16_MASK);
-               writeb(0x01, base + VME_SLAVE16_EN);
-       } else {
-               writeb(0xff, base + VME_SLAVE16_MASK);
-               writeb(0x00, base + VME_SLAVE16_EN);
-       }
-#else
-       writeb(0xff, base + VME_SLAVE16_MASK);
-       writeb(0x00, base + VME_SLAVE16_EN);
-#endif
-#ifdef REG_SLV_WINDOW
-       if (readb(base + VME_STATUS) & VME_STATUS_SYSCON) {
-               writeb(((~(VME_REG_SLV_SIZE-1)) >> 16) & 0xff,
-                               base + VME_SLAVE_REG_MASK);
-               writeb(0x01, base + VME_SLAVE_REG_EN);
-       } else {
-               writeb(0xf8, base + VME_SLAVE_REG_MASK);
-       }
-#else
-       writeb(0xf8, base + VME_SLAVE_REG_MASK);
-#endif
-       writeb(0x09, base + VME_MASTER32_AM);
-       writeb(0x39, base + VME_MASTER24_AM);
-       writeb(0x29, base + VME_MASTER16_AM);
-       writeb(0x2f, base + VME_MASTER_REG_AM);
-       writel(0x00000000, base + VME_RMW_ADRS);
-       writeb(0x00, base + VME_IRQ);
-       writeb(0x00, base + VME_INT_EN);
-       writel(0x00000000, base + VME_IRQ1_REG);
-       writel(0x00000000, base + VME_IRQ2_REG);
-       writel(0x00000000, base + VME_IRQ3_REG);
-       writel(0x00000000, base + VME_IRQ4_REG);
-       writel(0x00000000, base + VME_IRQ5_REG);
-       writel(0x00000000, base + VME_IRQ6_REG);
-       writel(0x00000000, base + VME_IRQ7_REG);
-       return 0;
-}
-
-void multiv_auto_slot_id(unsigned long base)
-{
-       __maybe_unused unsigned int vector;
-       int slot_id = 1;
-       if (readb(base + VME_CTRL) & VME_CTRL_SYSFAIL) {
-               *(volatile unsigned int*)(base + VME_IRQ2_REG) = 0xfe;
-               writeb(readb(base + VME_IRQ) | 0x04, base + VME_IRQ);
-               writeb(readb(base + VME_CTRL) & ~VME_CTRL_SYSFAIL,
-                               base + VME_CTRL);
-               while (readb(base + VME_STATUS) & VME_STATUS_SYSFAIL);
-               if (readb(base + VME_STATUS) & VME_STATUS_SYSCON) {
-                       while (readb(base + VME_INT) & 0x04) {
-                               vector = *(volatile unsigned int*)
-                                       (vme_iack_addr + VME_IACK2);
-                               *(unsigned char*)(vme_asi_addr + 0x7ffff)
-                                       = (slot_id << 3) & 0xff;
-                               slot_id ++;
-                               if (slot_id > 31)
-                                       break;
-                       }
-               }
-       }
-}
-
-int multiverse_init(void)
-{
-       int i;
-       pci_dev_t pdev;
-       unsigned int bar[6];
-
-       pdev = pci_find_device(0x1895, 0x0001, 0);
-
-       if (pdev == 0)
-               return -1;
-
-       for (i = 0; i < 6; i++)
-               pci_read_config_dword (pdev,
-                               PCI_BASE_ADDRESS_0 + i * 4, &bar[i]);
-
-       pci_reg_addr = bar[0];
-       vme_reg_addr = bar[1] + 0x00F00000;
-       vme_iack_addr = bar[1] + 0x00200000;
-       vme_asi_addr = bar[3];
-
-       pci_write_config_dword (pdev, PCI_COMMAND,
-               PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
-
-       writel(0xFF000000, pci_reg_addr + P_TA1);
-       writel(0x04, pci_reg_addr + P_IMG_CTRL1);
-       writel(0xf0000000, pci_reg_addr + P_TA2);
-       writel(0x04, pci_reg_addr + P_IMG_CTRL2);
-       writel(0xF1000000, pci_reg_addr + P_TA3);
-       writel(0x04, pci_reg_addr + P_IMG_CTRL3);
-       writel(VME_A32_MSTR_BUS, pci_reg_addr + P_TA5);
-       writel(~(VME_A32_MSTR_SIZE-1), pci_reg_addr + P_AM5);
-       writel(0x04, pci_reg_addr + P_IMG_CTRL5);
-
-       writel(VME_A32_SLV_BUS, pci_reg_addr + W_BA1);
-       writel(~(VME_A32_SLV_SIZE-1), pci_reg_addr + W_AM1);
-       writel(VME_A32_SLV_LOCAL, pci_reg_addr + W_TA1);
-       writel(0x04, pci_reg_addr + W_IMG_CTRL1);
-
-       writel(0xF0000000, pci_reg_addr + W_BA2);
-       writel(0xFF000000, pci_reg_addr + W_AM2);
-       writel(VME_A24_SLV_LOCAL, pci_reg_addr + W_TA2);
-       writel(0x04, pci_reg_addr + W_IMG_CTRL2);
-
-       writel(0xFF000000, pci_reg_addr + W_BA3);
-       writel(0xFF000000, pci_reg_addr + W_AM3);
-       writel(VME_A16_SLV_LOCAL, pci_reg_addr + W_TA3);
-       writel(0x04, pci_reg_addr + W_IMG_CTRL3);
-
-       writel(0x00000001, pci_reg_addr + W_ERR_CS);
-       writel(0x00000001, pci_reg_addr + P_ERR_CS);
-
-       multiv_reset(vme_reg_addr);
-       writeb(readb(vme_reg_addr + VME_CTRL) | VME_CTRL_SHORT_D,
-               vme_reg_addr + VME_CTRL);
-
-       multiv_auto_slot_id(vme_reg_addr);
-
-       return 0;
-}
diff --git a/board/etin/kvme080/multiverse.h b/board/etin/kvme080/multiverse.h
deleted file mode 100644 (file)
index b3b79b7..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * multiverse.h
- *
- * VME driver for Multiverse
- *
- * Author : Sangmoon Kim
- *         dogoil@etinsys.com
- *
- * Copyright 2005 ETIN SYSTEMS Co.,Ltd.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef __MULTIVERSE_H__
-#define __MULTIVERSE_H__
-
-#define VME_A32_MSTR_BUS       0x90000000
-#define VME_A32_MSTR_SIZE      0x01000000
-
-#define VME_A32_SLV_SIZE       0x01000000
-
-#define VME_A32_SLV_BUS                0x90000000
-#define VME_A24_SLV_BUS                0x00000000
-#define VME_A16_SLV_BUS                0x00000000
-
-#define VME_A32_SLV_LOCAL      0x00000000
-#define VME_A24_SLV_LOCAL      0x00000000
-#define VME_A16_SLV_LOCAL      0x00000000
-
-#define A32_SLV_WINDOW
-#undef A24_SLV_WINDOW
-#undef A16_SLV_WINDOW
-#undef REG_SLV_WINDOW
-
-/* PCI Registers */
-
-#define P_IMG_CTRL0            0x100
-#define P_BA0                  0x104
-#define P_AM0                  0x108
-#define P_TA0                  0x10C
-#define P_IMG_CTRL1            0x110
-#define P_BA1                  0x114
-#define P_AM1                  0x118
-#define P_TA1                  0x11C
-#define P_IMG_CTRL2            0x120
-#define P_BA2                  0x124
-#define P_AM2                  0x128
-#define P_TA2                  0x12C
-#define P_IMG_CTRL3            0x130
-#define P_BA3                  0x134
-#define P_AM3                  0x138
-#define P_TA3                  0x13C
-#define P_IMG_CTRL4            0x140
-#define P_BA4                  0x144
-#define P_AM4                  0x148
-#define P_TA4                  0x14C
-#define P_IMG_CTRL5            0x150
-#define P_BA5                  0x154
-#define P_AM5                  0x158
-#define P_TA5                  0x15C
-#define P_ERR_CS               0x160
-#define P_ERR_ADDR             0x164
-#define P_ERR_DATA             0x168
-
-#define WB_CONF_SPC_BAR                0x180
-#define W_IMG_CTRL1            0x184
-#define W_BA1                  0x188
-#define W_AM1                  0x18C
-#define W_TA1                  0x190
-#define W_IMG_CTRL2            0x194
-#define W_BA2                  0x198
-#define W_AM2                  0x19C
-#define W_TA2                  0x1A0
-#define W_IMG_CTRL3            0x1A4
-#define W_BA3                  0x1A8
-#define W_AM3                  0x1AC
-#define W_TA3                  0x1B0
-#define W_IMG_CTRL4            0x1B4
-#define W_BA4                  0x1B8
-#define W_AM4                  0x1BC
-#define W_TA4                  0x1C0
-#define W_IMG_CTRL5            0x1C4
-#define W_BA5                  0x1C8
-#define W_AM5                  0x1CC
-#define W_TA5                  0x1D0
-#define W_ERR_CS               0x1D4
-#define W_ERR_ADDR             0x1D8
-#define W_ERR_DATA             0x1DC
-#define CNF_ADDR               0x1E0
-#define CNF_DATA               0x1E4
-#define INT_ACK                        0x1E8
-#define ICR                    0x1EC
-#define ISR                    0x1F0
-
-/* VME registers */
-
-#define VME_SLAVE32_AM         0x03
-#define VME_SLAVE24_AM         0x02
-#define VME_SLAVE16_AM         0x01
-#define VME_SLAVE_REG_AM       0x00
-#define VME_SLAVE32_A          0x07
-#define VME_SLAVE24_A          0x06
-#define VME_SLAVE16_A          0x05
-#define VME_SLAVE_REG_A                0x04
-#define VME_SLAVE32_MASK       0x0B
-#define VME_SLAVE24_MASK       0x0A
-#define VME_SLAVE16_MASK       0x09
-#define VME_SLAVE_REG_MASK     0x08
-#define VME_SLAVE32_EN         0x0F
-#define VME_SLAVE24_EN         0x0E
-#define VME_SLAVE16_EN         0x0D
-#define VME_SLAVE_REG_EN       0x0C
-#define VME_MASTER32_AM                0x13
-#define VME_MASTER24_AM                0x12
-#define VME_MASTER16_AM                0x11
-#define VME_MASTER_REG_AM      0x10
-#define VME_RMW_ADRS           0x14
-#define VME_MBOX               0x18
-#define VME_STATUS             0x1E
-#define VME_CTRL               0x1C
-#define VME_IRQ                        0x20
-#define VME_INT_EN             0x21
-#define VME_INT                        0x22
-#define VME_IRQ1_REG           0x24
-#define VME_IRQ2_REG           0x28
-#define VME_IRQ3_REG           0x2C
-#define VME_IRQ4_REG           0x30
-#define VME_IRQ5_REG           0x34
-#define VME_IRQ6_REG           0x38
-#define VME_IRQ7_REG           0x3C
-
-/* VME control register */
-
-#define VME_CTRL_BRDRST                0x01
-#define VME_CTRL_SYSRST                0x02
-#define VME_CTRL_RMW           0x04
-#define VME_CTRL_SHORT_D       0x08
-#define VME_CTRL_SYSFAIL       0x10
-#define VME_CTRL_VOWN          0x20
-#define VME_CTRL_A16_REG_MODE  0x40
-
-/* VME status register */
-
-#define VME_STATUS_SYSCON      0x01
-#define VME_STATUS_SYSFAIL     0x02
-#define VME_STATUS_ACFAIL      0x04
-#define VME_STATUS_SYSRST      0x08
-#define VME_STATUS_VOWN                0x10
-
-/* Interrupt types */
-
-#define LVL1                   0x0002
-#define LVL2                   0x0004
-#define LVL3                   0x0008
-#define LVL4                   0x0010
-#define LVL5                   0x0020
-#define LVL6                   0x0040
-#define LVL7                   0x0080
-#define MULTIVERSE_INTI_INT    0x0100
-#define MULTIVERSE_WB_INT      0x0200
-#define MULTIVERSE_PCI_INT     0x0400
-
-/* interrupt acknowledge */
-
-#define VME_IACK1              0x04
-#define VME_IACK2              0x08
-#define VME_IACK3              0x0c
-#define VME_IACK4              0x10
-#define VME_IACK5              0x14
-#define VME_IACK6              0x18
-#define VME_IACK7              0x1c
-
-#endif /* __MULTIVERSE_H__ */
diff --git a/board/freescale/mpc8260ads/Makefile b/board/freescale/mpc8260ads/Makefile
deleted file mode 100644 (file)
index 007d958..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2001-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  := mpc8260ads.o flash.o
diff --git a/board/freescale/mpc8260ads/flash.c b/board/freescale/mpc8260ads/flash.c
deleted file mode 100644 (file)
index 4012d45..0000000
+++ /dev/null
@@ -1,476 +0,0 @@
-/*
- * (C) Copyright 2000, 2001
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2001, Stuart Hughes, Lineo Inc, stuarth@lineo.com
- * Add support the Sharp chips on the mpc8260ads.
- * I started with board/ip860/flash.c and made changes I found in
- * the MTD project by David Schleef.
- *
- * (C) Copyright 2003 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- * Re-written to support multi-bank flash SIMMs.
- * Added support for real protection and JFFS2.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-
-/* Intel-compatible flash ID */
-#define INTEL_COMPAT  0x89898989
-#define INTEL_ALT     0xB0B0B0B0
-
-/* Intel-compatible flash commands */
-#define INTEL_PROGRAM 0x10101010
-#define INTEL_ERASE   0x20202020
-#define INTEL_CLEAR   0x50505050
-#define INTEL_LOCKBIT 0x60606060
-#define INTEL_PROTECT 0x01010101
-#define INTEL_STATUS  0x70707070
-#define INTEL_READID  0x90909090
-#define INTEL_CONFIRM 0xD0D0D0D0
-#define INTEL_RESET   0xFFFFFFFF
-
-/* Intel-compatible flash status bits */
-#define INTEL_FINISHED 0x80808080
-#define INTEL_OK       0x80808080
-
-flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips */
-
-/*-----------------------------------------------------------------------
- * This board supports 32-bit wide flash SIMMs (4x8-bit configuration.)
- * Up to 32MB of flash supported (up to 4 banks.)
- * BCSR is used for flash presence detect (page 4-65 of the User's Manual)
- *
- * The following code can not run from flash!
- */
-unsigned long flash_init (void)
-{
-       ulong size = 0, sect_start, sect_size = 0, bank_size;
-       ushort sect_count = 0;
-       int i, j, nbanks;
-       vu_long *addr = (vu_long *)CONFIG_SYS_FLASH_BASE;
-       vu_long *bcsr = (vu_long *)CONFIG_SYS_BCSR;
-
-       switch (bcsr[2] & 0xF) {
-       case 0:
-               nbanks = 4;
-               break;
-       case 1:
-               nbanks = 2;
-               break;
-       case 2:
-               nbanks = 1;
-               break;
-       default:                /* Unsupported configurations */
-               nbanks = CONFIG_SYS_MAX_FLASH_BANKS;
-       }
-
-       if (nbanks > CONFIG_SYS_MAX_FLASH_BANKS)
-               nbanks = CONFIG_SYS_MAX_FLASH_BANKS;
-
-       for (i = 0; i < nbanks; i++) {
-               *addr = INTEL_READID;   /* Read Intelligent Identifier */
-               if ((addr[0] == INTEL_COMPAT) || (addr[0] == INTEL_ALT)) {
-                       switch (addr[1]) {
-                       case SHARP_ID_28F016SCL:
-                       case SHARP_ID_28F016SCZ:
-                               flash_info[i].flash_id = FLASH_MAN_SHARP | FLASH_LH28F016SCT;
-                               sect_count = 32;
-                               sect_size = 0x40000;
-                               break;
-                       default:
-                               flash_info[i].flash_id = FLASH_UNKNOWN;
-                               sect_count = CONFIG_SYS_MAX_FLASH_SECT;
-                               sect_size =
-                                  CONFIG_SYS_FLASH_SIZE / CONFIG_SYS_MAX_FLASH_BANKS / CONFIG_SYS_MAX_FLASH_SECT;
-                       }
-               }
-               else
-                       flash_info[i].flash_id = FLASH_UNKNOWN;
-               if (flash_info[i].flash_id == FLASH_UNKNOWN) {
-                       printf("### Unknown flash ID %08lX %08lX at address %08lX ###\n",
-                              addr[0], addr[1], (ulong)addr);
-                       size = 0;
-                       *addr = INTEL_RESET; /* Reset bank to Read Array mode */
-                       break;
-               }
-               flash_info[i].sector_count = sect_count;
-               flash_info[i].size = bank_size = sect_size * sect_count;
-               size += bank_size;
-               sect_start = (ulong)addr;
-               for (j = 0; j < sect_count; j++) {
-                       addr = (vu_long *)sect_start;
-                       flash_info[i].start[j]   = sect_start;
-                       flash_info[i].protect[j] = (addr[2] == 0x01010101);
-                       sect_start += sect_size;
-               }
-               *addr = INTEL_RESET; /* Reset bank to Read Array mode */
-               addr = (vu_long *)sect_start;
-       }
-
-       if (size == 0) {        /* Unknown flash, fill with hard-coded values */
-               sect_start = CONFIG_SYS_FLASH_BASE;
-               for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
-                       flash_info[i].flash_id = FLASH_UNKNOWN;
-                       flash_info[i].size = CONFIG_SYS_FLASH_SIZE / CONFIG_SYS_MAX_FLASH_BANKS;
-                       flash_info[i].sector_count = sect_count;
-                       for (j = 0; j < sect_count; j++) {
-                               flash_info[i].start[j]   = sect_start;
-                               flash_info[i].protect[j] = 0;
-                               sect_start += sect_size;
-                       }
-               }
-               size = CONFIG_SYS_FLASH_SIZE;
-       }
-       else
-               for (i = nbanks; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
-                       flash_info[i].flash_id = FLASH_UNKNOWN;
-                       flash_info[i].size = 0;
-                       flash_info[i].sector_count = 0;
-               }
-
-#if CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE
-       /* monitor protection ON by default */
-       flash_protect(FLAG_PROTECT_SET,
-                     CONFIG_SYS_MONITOR_BASE,
-                     CONFIG_SYS_MONITOR_BASE+monitor_flash_len-1,
-                     &flash_info[0]);
-#endif
-
-#ifdef CONFIG_ENV_IS_IN_FLASH
-       /* ENV protection ON by default */
-       flash_protect(FLAG_PROTECT_SET,
-                     CONFIG_ENV_ADDR,
-                     CONFIG_ENV_ADDR+CONFIG_ENV_SECT_SIZE-1,
-                     &flash_info[0]);
-#endif
-       return (size);
-}
-
-/*-----------------------------------------------------------------------
- */
-void flash_print_info  (flash_info_t *info)
-{
-       int i;
-
-       if (info->flash_id == FLASH_UNKNOWN) {
-               printf ("missing or unknown FLASH type\n");
-               return;
-       }
-
-       switch (info->flash_id & FLASH_VENDMASK) {
-       case FLASH_MAN_INTEL:   printf ("Intel ");              break;
-       case FLASH_MAN_SHARP:   printf ("Sharp ");              break;
-       default:                printf ("Unknown Vendor ");     break;
-       }
-
-       switch (info->flash_id & FLASH_TYPEMASK) {
-       case FLASH_28F016SV:    printf ("28F016SV (16 Mbit, 32 x 64k)\n");
-                               break;
-       case FLASH_28F160S3:    printf ("28F160S3 (16 Mbit, 32 x 512K)\n");
-                               break;
-       case FLASH_28F320S3:    printf ("28F320S3 (32 Mbit, 64 x 512K)\n");
-                               break;
-       case FLASH_LH28F016SCT: printf ("28F016SC (16 Mbit, 32 x 64K)\n");
-                               break;
-       default:                printf ("Unknown Chip Type\n");
-                               break;
-       }
-
-       printf ("  Size: %ld MB in %d Sectors\n",
-               info->size >> 20, info->sector_count);
-
-       printf ("  Sector Start Addresses:");
-       for (i=0; i<info->sector_count; ++i) {
-               if ((i % 5) == 0)
-                       printf ("\n   ");
-               printf (" %08lX%s",
-                       info->start[i],
-                       info->protect[i] ? " (RO)" : "     "
-               );
-       }
-       printf ("\n");
-}
-
-/*-----------------------------------------------------------------------
- */
-int    flash_erase (flash_info_t *info, int s_first, int s_last)
-{
-       int flag, prot, sect;
-       ulong start, now, last;
-
-       if ((s_first < 0) || (s_first > s_last)) {
-               if (info->flash_id == FLASH_UNKNOWN) {
-                       printf ("- missing\n");
-               } else {
-                       printf ("- no sectors to erase\n");
-               }
-               return 1;
-       }
-
-       if (    ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_INTEL)
-            && ((info->flash_id & FLASH_VENDMASK) != FLASH_MAN_SHARP) ) {
-               printf ("Can't erase unknown flash type %08lx - aborted\n",
-                       info->flash_id);
-               return 1;
-       }
-
-       prot = 0;
-       for (sect=s_first; sect<=s_last; ++sect) {
-               if (info->protect[sect]) {
-                       prot++;
-               }
-       }
-
-       if (prot) {
-               printf ("- Warning: %d protected sectors will not be erased!\n",
-                       prot);
-       } else {
-               printf ("\n");
-       }
-
-       /* Start erase on unprotected sectors */
-       for (sect = s_first; sect<=s_last; sect++) {
-               if (info->protect[sect] == 0) { /* not protected */
-                       vu_long *addr = (vu_long *)(info->start[sect]);
-
-                       last = start = get_timer (0);
-
-                       /* Disable interrupts which might cause a timeout here */
-                       flag = disable_interrupts();
-
-                       /* Clear Status Register */
-                       *addr = INTEL_CLEAR;
-                       /* Single Block Erase Command */
-                       *addr = INTEL_ERASE;
-                       /* Confirm */
-                       *addr = INTEL_CONFIRM;
-
-                       if((info->flash_id & FLASH_TYPEMASK) != FLASH_LH28F016SCT) {
-                           /* Resume Command, as per errata update */
-                           *addr = INTEL_CONFIRM;
-                       }
-
-                       /* re-enable interrupts if necessary */
-                       if (flag)
-                               enable_interrupts();
-
-                       while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
-                               if ((now=get_timer(start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
-                                       printf ("Timeout\n");
-                                       *addr = INTEL_RESET;    /* reset bank */
-                                       return 1;
-                               }
-                               /* show that we're waiting */
-                               if ((now - last) > 1000) {      /* every second */
-                                       putc ('.');
-                                       last = now;
-                               }
-                       }
-
-                       if (*addr != INTEL_OK) {
-                               printf("Block erase failed at %08X, CSR=%08X\n",
-                                      (uint)addr, (uint)*addr);
-                               *addr = INTEL_RESET;    /* reset bank */
-                               return 1;
-                       }
-
-                       /* reset to read mode */
-                       *addr = INTEL_RESET;
-               }
-       }
-
-       printf (" done\n");
-       return 0;
-}
-
-/*-----------------------------------------------------------------------
- * Write a word to Flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-static int write_word (flash_info_t *info, ulong dest, ulong data)
-{
-       ulong start;
-       int rc = 0;
-       int flag;
-       vu_long *addr = (vu_long *)dest;
-
-       /* Check if Flash is (sufficiently) erased */
-       if ((*addr & data) != data) {
-               return (2);
-       }
-
-       *addr = INTEL_CLEAR; /* Clear status register */
-
-       /* Disable interrupts which might cause a timeout here */
-       flag = disable_interrupts();
-
-       /* Write Command */
-       *addr = INTEL_PROGRAM;
-
-       /* Write Data */
-       *addr = data;
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts();
-
-       /* data polling for D7 */
-       start = get_timer (0);
-       while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
-               if (get_timer(start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
-                       printf("Write timed out\n");
-                       rc = 1;
-                       break;
-               }
-       }
-       if (*addr != INTEL_OK) {
-               printf ("Write failed at %08X, CSR=%08X\n", (uint)addr, (uint)*addr);
-               rc = 1;
-       }
-
-       *addr = INTEL_RESET; /* Reset to read array mode */
-
-       return rc;
-}
-
-/*-----------------------------------------------------------------------
- * Copy memory to flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-
-int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
-{
-       ulong cp, wp, data;
-       int i, l, rc;
-
-       wp = (addr & ~3);       /* get lower word aligned address */
-
-       *(vu_long *)wp = INTEL_RESET; /* Reset to read array mode */
-
-       /*
-        * handle unaligned start bytes
-        */
-       if ((l = addr - wp) != 0) {
-               data = 0;
-               for (i=0, cp=wp; i<l; ++i, ++cp) {
-                       data = (data << 8) | (*(uchar *)cp);
-               }
-               for (; i<4 && cnt>0; ++i) {
-                       data = (data << 8) | *src++;
-                       --cnt;
-                       ++cp;
-               }
-               for (; cnt==0 && i<4; ++i, ++cp) {
-                       data = (data << 8) | (*(uchar *)cp);
-               }
-
-               if ((rc = write_word(info, wp, data)) != 0) {
-                       return (rc);
-               }
-               wp += 4;
-       }
-
-       /*
-        * handle word aligned part
-        */
-       while (cnt >= 4) {
-               data = 0;
-               for (i=0; i<4; ++i) {
-                       data = (data << 8) | *src++;
-               }
-               if ((rc = write_word(info, wp, data)) != 0) {
-                       return (rc);
-               }
-               wp  += 4;
-               cnt -= 4;
-       }
-
-       if (cnt == 0) {
-               return (0);
-       }
-
-       /*
-        * handle unaligned tail bytes
-        */
-       data = 0;
-       for (i=0, cp=wp; i<4 && cnt>0; ++i, ++cp) {
-               data = (data << 8) | *src++;
-               --cnt;
-       }
-       for (; i<4; ++i, ++cp) {
-               data = (data << 8) | (*(uchar *)cp);
-       }
-
-       rc = write_word(info, wp, data);
-
-       return rc;
-}
-
-/*-----------------------------------------------------------------------
- * Set/Clear sector's lock bit, returns:
- * 0 - OK
- * 1 - Error (timeout, voltage problems, etc.)
- */
-int flash_real_protect(flash_info_t *info, long sector, int prot)
-{
-       ulong start;
-       int i;
-       int rc = 0;
-       vu_long *addr = (vu_long *)(info->start[sector]);
-       int flag = disable_interrupts();
-
-       *addr = INTEL_CLEAR;    /* Clear status register */
-       if (prot) {                     /* Set sector lock bit */
-               *addr = INTEL_LOCKBIT;  /* Sector lock bit */
-               *addr = INTEL_PROTECT;  /* set */
-       }
-       else {                          /* Clear sector lock bit */
-               *addr = INTEL_LOCKBIT;  /* All sectors lock bits */
-               *addr = INTEL_CONFIRM;  /* clear */
-       }
-
-       start = get_timer(0);
-       while ((*addr & INTEL_FINISHED) != INTEL_FINISHED) {
-               if (get_timer(start) > CONFIG_SYS_FLASH_UNLOCK_TOUT) {
-                       printf("Flash lock bit operation timed out\n");
-                       rc = 1;
-                       break;
-               }
-       }
-
-       if (*addr != INTEL_OK) {
-               printf("Flash lock bit operation failed at %08X, CSR=%08X\n",
-                      (uint)addr, (uint)*addr);
-               rc = 1;
-       }
-
-       if (!rc)
-               info->protect[sector] = prot;
-
-       /*
-        * Clear lock bit command clears all sectors lock bits, so
-        * we have to restore lock bits of protected sectors.
-        */
-       if (!prot)
-               for (i = 0; i < info->sector_count; i++)
-                       if (info->protect[i]) {
-                               addr = (vu_long *)(info->start[i]);
-                               *addr = INTEL_LOCKBIT;  /* Sector lock bit */
-                               *addr = INTEL_PROTECT;  /* set */
-                               udelay(CONFIG_SYS_FLASH_LOCK_TOUT * 1000);
-                       }
-
-       if (flag)
-               enable_interrupts();
-
-       *addr = INTEL_RESET;            /* Reset to read array mode */
-
-       return rc;
-}
diff --git a/board/freescale/mpc8260ads/mpc8260ads.c b/board/freescale/mpc8260ads/mpc8260ads.c
deleted file mode 100644 (file)
index b8c8ce9..0000000
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * (C) Copyright 2001-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * Modified during 2001 by
- * Advanced Communications Technologies (Australia) Pty. Ltd.
- * Howard Walker, Tuong Vu-Dinh
- *
- * (C) Copyright 2001, Stuart Hughes, Lineo Inc, stuarth@lineo.com
- * Added support for the 16M dram simm on the 8260ads boards
- *
- * (C) Copyright 2003-2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- * Added support for SDRAM DIMMs SPD EEPROM, MII, Ethernet PHY init.
- *
- * Copyright (c) 2005 MontaVista Software, Inc.
- * Vitaly Bordug <vbordug@ru.mvista.com>
- * Added support for PCI.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <ioports.h>
-#include <mpc8260.h>
-#include <asm/m8260_pci.h>
-#include <i2c.h>
-#include <spd.h>
-#include <miiphy.h>
-#ifdef CONFIG_PCI
-#include <pci.h>
-#endif
-#ifdef CONFIG_OF_LIBFDT
-#include <libfdt.h>
-#include <fdt_support.h>
-#endif
-
-/*
- * I/O Port configuration table
- *
- * if conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-#define CONFIG_SYS_FCC1 (CONFIG_ETHER_INDEX == 1)
-#define CONFIG_SYS_FCC2 (CONFIG_ETHER_INDEX == 2)
-#define CONFIG_SYS_FCC3 (CONFIG_ETHER_INDEX == 3)
-
-const iop_conf_t iop_conf_tab[4][32] = {
-
-    /* Port A configuration */
-    {  /*            conf      ppar psor pdir podr pdat */
-       /* PA31 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII COL   */
-       /* PA30 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII CRS   */
-       /* PA29 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_ER */
-       /* PA28 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_EN */
-       /* PA27 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_DV */
-       /* PA26 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_ER */
-       /* PA25 */ { 0,          0,   0,   0,   0,   0 }, /* PA25 */
-       /* PA24 */ { 0,          0,   0,   0,   0,   0 }, /* PA24 */
-       /* PA23 */ { 0,          0,   0,   0,   0,   0 }, /* PA23 */
-       /* PA22 */ { 0,          0,   0,   0,   0,   0 }, /* PA22 */
-       /* PA21 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[3] */
-       /* PA20 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[2] */
-       /* PA19 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[1] */
-       /* PA18 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[0] */
-       /* PA17 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[0] */
-       /* PA16 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[1] */
-       /* PA15 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[2] */
-       /* PA14 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[3] */
-       /* PA13 */ { 0,          0,   0,   0,   0,   0 }, /* PA13 */
-       /* PA12 */ { 0,          0,   0,   0,   0,   0 }, /* PA12 */
-       /* PA11 */ { 0,          0,   0,   0,   0,   0 }, /* PA11 */
-       /* PA10 */ { 0,          0,   0,   0,   0,   0 }, /* PA10 */
-       /* PA9  */ { 0,          0,   0,   0,   0,   0 }, /* PA9 */
-       /* PA8  */ { 0,          0,   0,   0,   0,   0 }, /* PA8 */
-       /* PA7  */ { 0,          0,   0,   1,   0,   0 }, /* PA7 */
-       /* PA6  */ { 0,          0,   0,   0,   0,   0 }, /* PA6 */
-       /* PA5  */ { 0,          0,   0,   1,   0,   0 }, /* PA5 */
-       /* PA4  */ { 0,          0,   0,   1,   0,   0 }, /* PA4 */
-       /* PA3  */ { 0,          0,   0,   1,   0,   0 }, /* PA3 */
-       /* PA2  */ { 0,          0,   0,   1,   0,   0 }, /* PA2 */
-       /* PA1  */ { 0,          0,   0,   0,   0,   0 }, /* PA1 */
-       /* PA0  */ { 0,          0,   0,   1,   0,   0 }  /* PA0 */
-    },
-
-    /* Port B configuration */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PB31 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TX_ER */
-       /* PB30 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_DV */
-       /* PB29 */ { CONFIG_SYS_FCC2,   1,   1,   1,   0,   0 }, /* FCC2 MII TX_EN */
-       /* PB28 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_ER */
-       /* PB27 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII COL */
-       /* PB26 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII CRS */
-       /* PB25 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[3] */
-       /* PB24 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[2] */
-       /* PB23 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[1] */
-       /* PB22 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[0] */
-       /* PB21 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[0] */
-       /* PB20 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[1] */
-       /* PB19 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[2] */
-       /* PB18 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[3] */
-       /* PB17 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:RX_DIV */
-       /* PB16 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:RX_ERR */
-       /* PB15 */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3:TX_ERR */
-       /* PB14 */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3:TX_EN */
-       /* PB13 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:COL */
-       /* PB12 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:CRS */
-       /* PB11 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:RXD */
-       /* PB10 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:RXD */
-       /* PB9  */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:RXD */
-       /* PB8  */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3:RXD */
-       /* PB7  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3:TXD */
-       /* PB6  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3:TXD */
-       /* PB5  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3:TXD */
-       /* PB4  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3:TXD */
-       /* PB3  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PB2  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PB1  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PB0  */ { 0,          0,   0,   0,   0,   0 }  /* pin doesn't exist */
-    },
-
-    /* Port C */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PC31 */ { 0,          0,   0,   0,   0,   0 }, /* PC31 */
-       /* PC30 */ { 0,          0,   0,   0,   0,   0 }, /* PC30 */
-       /* PC29 */ { 0,          0,   0,   0,   0,   0 }, /* PC29 */
-       /* PC28 */ { 0,          0,   0,   0,   0,   0 }, /* PC28 */
-       /* PC27 */ { 0,          0,   0,   0,   0,   0 }, /* PC27 */
-       /* PC26 */ { 0,          0,   0,   0,   0,   0 }, /* PC26 */
-       /* PC25 */ { 0,          0,   0,   0,   0,   0 }, /* PC25 */
-       /* PC24 */ { 0,          0,   0,   0,   0,   0 }, /* PC24 */
-       /* PC23 */ { 0,          0,   0,   0,   0,   0 }, /* PC23 */
-       /* PC22 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII Tx Clock (CLK10) */
-       /* PC21 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII Rx Clock (CLK11) */
-       /* PC20 */ { 0,          0,   0,   0,   0,   0 }, /* PC20 */
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-       /* PC19 */ { 1,          0,   0,   1,   0,   0 }, /* FETHMDC  */
-       /* PC18 */ { 1,          0,   0,   0,   0,   0 }, /* FETHMDIO */
-       /* PC17 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII Rx Clock (CLK15) */
-       /* PC16 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII Tx Clock (CLK16) */
-#else
-       /* PC19 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII Rx Clock (CLK13) */
-       /* PC18 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII Tx Clock (CLK14) */
-       /* PC17 */ { 0,          0,   0,   0,   0,   0 }, /* PC17 */
-       /* PC16 */ { 0,          0,   0,   0,   0,   0 }, /* PC16 */
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_8272ADS */
-       /* PC15 */ { 0,          0,   0,   0,   0,   0 }, /* PC15 */
-       /* PC14 */ { 0,          0,   0,   0,   0,   0 }, /* PC14 */
-       /* PC13 */ { 0,          0,   0,   0,   0,   0 }, /* PC13 */
-       /* PC12 */ { 0,          0,   0,   0,   0,   0 }, /* PC12 */
-       /* PC11 */ { 0,          0,   0,   0,   0,   0 }, /* PC11 */
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-       /* PC10 */ { 0,          0,   0,   0,   0,   0 }, /* PC10 */
-       /* PC9  */ { 0,          0,   0,   0,   0,   0 }, /* PC9  */
-#else
-       /* PC10 */ { 1,          0,   0,   1,   0,   0 }, /* FETHMDC  */
-       /* PC9  */ { 1,          0,   0,   0,   0,   0 }, /* FETHMDIO */
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_8272ADS */
-       /* PC8  */ { 0,          0,   0,   0,   0,   0 }, /* PC8 */
-       /* PC7  */ { 0,          0,   0,   0,   0,   0 }, /* PC7 */
-       /* PC6  */ { 0,          0,   0,   0,   0,   0 }, /* PC6 */
-       /* PC5  */ { 0,          0,   0,   0,   0,   0 }, /* PC5 */
-       /* PC4  */ { 0,          0,   0,   0,   0,   0 }, /* PC4 */
-       /* PC3  */ { 0,          0,   0,   0,   0,   0 }, /* PC3 */
-       /* PC2  */ { 0,          0,   0,   0,   0,   0 }, /* PC2 */
-       /* PC1  */ { 0,          0,   0,   0,   0,   0 }, /* PC1 */
-       /* PC0  */ { 0,          0,   0,   0,   0,   0 }, /* PC0 */
-    },
-
-    /* Port D */
-    {   /*           conf ppar psor pdir podr pdat */
-       /* PD31 */ {   1,   1,   0,   0,   0,   0   }, /* SCC1 UART RxD */
-       /* PD30 */ {   1,   1,   1,   1,   0,   0   }, /* SCC1 UART TxD */
-       /* PD29 */ {   0,   0,   0,   0,   0,   0   }, /* PD29 */
-       /* PD28 */ {   0,   1,   0,   0,   0,   0   }, /* PD28 */
-       /* PD27 */ {   0,   1,   1,   1,   0,   0   }, /* PD27 */
-       /* PD26 */ {   0,   0,   0,   1,   0,   0   }, /* PD26 */
-       /* PD25 */ {   0,   0,   0,   1,   0,   0   }, /* PD25 */
-       /* PD24 */ {   0,   0,   0,   1,   0,   0   }, /* PD24 */
-       /* PD23 */ {   0,   0,   0,   1,   0,   0   }, /* PD23 */
-       /* PD22 */ {   0,   0,   0,   1,   0,   0   }, /* PD22 */
-       /* PD21 */ {   0,   0,   0,   1,   0,   0   }, /* PD21 */
-       /* PD20 */ {   0,   0,   0,   1,   0,   0   }, /* PD20 */
-       /* PD19 */ {   0,   0,   0,   1,   0,   0   }, /* PD19 */
-       /* PD18 */ {   0,   0,   0,   1,   0,   0   }, /* PD18 */
-       /* PD17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXPRTY */
-       /* PD16 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXPRTY */
-       /* PD15 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SDA */
-       /* PD14 */ {   1,   1,   1,   0,   1,   0   }, /* I2C SCL */
-       /* PD13 */ {   0,   0,   0,   0,   0,   0   }, /* PD13 */
-       /* PD12 */ {   0,   0,   0,   0,   0,   0   }, /* PD12 */
-       /* PD11 */ {   0,   0,   0,   0,   0,   0   }, /* PD11 */
-       /* PD10 */ {   0,   0,   0,   0,   0,   0   }, /* PD10 */
-       /* PD9  */ {   0,   1,   0,   1,   0,   0   }, /* SMC1 TXD */
-       /* PD8  */ {   0,   1,   0,   0,   0,   0   }, /* SMC1 RXD */
-       /* PD7  */ {   0,   0,   0,   1,   0,   1   }, /* PD7 */
-       /* PD6  */ {   0,   0,   0,   1,   0,   1   }, /* PD6 */
-       /* PD5  */ {   0,   0,   0,   1,   0,   1   }, /* PD5 */
-       /* PD4  */ {   0,   0,   0,   1,   0,   1   }, /* PD4 */
-       /* PD3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    }
-};
-
-void reset_phy (void)
-{
-       vu_long *bcsr = (vu_long *)CONFIG_SYS_BCSR;
-
-       /* Reset the PHY */
-#if CONFIG_SYS_PHY_ADDR == 0
-       bcsr[1] &= ~(FETHIEN1 | FETH1_RST);
-       udelay(2);
-       bcsr[1] |=  FETH1_RST;
-#else
-       bcsr[3] &= ~(FETHIEN2 | FETH2_RST);
-       udelay(2);
-       bcsr[3] |=  FETH2_RST;
-#endif /* CONFIG_SYS_PHY_ADDR == 0 */
-       udelay(1000);
-#ifdef CONFIG_MII
-#if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS
-       /*
-        * Do not bypass Rx/Tx (de)scrambler (fix configuration error)
-        * Enable autonegotiation.
-        */
-       bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, 16, 0x610);
-       bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_BMCR,
-                       BMCR_ANENABLE | BMCR_ANRESTART);
-#else
-       /*
-        * Ethernet PHY is configured (by means of configuration pins)
-        * to work at 10Mb/s only. We reconfigure it using MII
-        * to advertise all capabilities, including 100Mb/s, and
-        * restart autonegotiation.
-        */
-
-       /* Advertise all capabilities */
-       bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_ADVERTISE, 0x01E1);
-
-       /* Do not bypass Rx/Tx (de)scrambler */
-       bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_FCSCOUNTER,  0x0000);
-
-       bb_miiphy_write(NULL, CONFIG_SYS_PHY_ADDR, MII_BMCR,
-                       BMCR_ANENABLE | BMCR_ANRESTART);
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS */
-#endif /* CONFIG_MII */
-}
-
-#ifdef CONFIG_PCI
-typedef struct pci_ic_s {
-       unsigned long pci_int_stat;
-       unsigned long pci_int_mask;
-}pci_ic_t;
-#endif
-
-int board_early_init_f (void)
-{
-       vu_long *bcsr = (vu_long *)CONFIG_SYS_BCSR;
-
-#ifdef CONFIG_PCI
-       volatile pci_ic_t* pci_ic = (pci_ic_t *) CONFIG_SYS_PCI_INT;
-
-       /* mask alll the PCI interrupts */
-       pci_ic->pci_int_mask |= 0xfff00000;
-#endif
-#if (CONFIG_CONS_INDEX == 1) || (CONFIG_KGDB_INDEX == 1)
-       bcsr[1] &= ~RS232EN_1;
-#endif
-#if (CONFIG_CONS_INDEX > 1) || (CONFIG_KGDB_INDEX > 1)
-       bcsr[1] &= ~RS232EN_2;
-#endif
-
-#if CONFIG_ADSTYPE != CONFIG_SYS_8260ADS /* PCI mode can be selected */
-#if CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS
-       if ((bcsr[3] & BCSR_PCI_MODE) == 0) /* PCI mode selected by JP9 */
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS */
-       {
-               volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-
-               immap->im_clkrst.car_sccr |= M826X_SCCR_PCI_MODE_EN;
-               immap->im_siu_conf.sc_siumcr =
-                       (immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11)
-                       | SIUMCR_LBPC01;
-       }
-#endif /* CONFIG_ADSTYPE != CONFIG_SYS_8260ADS */
-
-       return 0;
-}
-
-#define ns2clk(ns) (ns / (1000000000 / CONFIG_8260_CLKIN) + 1)
-
-phys_size_t initdram (int board_type)
-{
-#if   CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS
-       long int msize = 32;
-#elif CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-       long int msize = 64;
-#else
-       long int msize = 16;
-#endif
-
-#ifndef CONFIG_SYS_RAMBOOT
-       volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-       volatile memctl8260_t *memctl = &immap->im_memctl;
-       volatile uchar *ramaddr, c = 0xff;
-       uint or;
-       uint psdmr;
-       uint psrt;
-
-       int i;
-
-       immap->im_siu_conf.sc_ppc_acr  = 0x00000002;
-       immap->im_siu_conf.sc_ppc_alrh = 0x01267893;
-       immap->im_siu_conf.sc_tescr1   = 0x00004000;
-
-       memctl->memc_mptpr = CONFIG_SYS_MPTPR;
-#ifdef CONFIG_SYS_LSDRAM_BASE
-       /*
-         Initialise local bus SDRAM only if the pins
-         are configured as local bus pins and not as PCI.
-         The configuration is determined by the HRCW.
-       */
-       if ((immap->im_siu_conf.sc_siumcr & SIUMCR_LBPC11) == SIUMCR_LBPC00) {
-               memctl->memc_lsrt  = CONFIG_SYS_LSRT;
-#if CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS /* CS3 */
-               memctl->memc_or3   = 0xFF803280;
-               memctl->memc_br3   = CONFIG_SYS_LSDRAM_BASE | 0x00001861;
-#else                            /* CS4 */
-               memctl->memc_or4   = 0xFFC01480;
-               memctl->memc_br4   = CONFIG_SYS_LSDRAM_BASE | 0x00001861;
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS */
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x28000000;
-               ramaddr = (uchar *) CONFIG_SYS_LSDRAM_BASE;
-               *ramaddr = c;
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x08000000;
-               for (i = 0; i < 8; i++)
-                       *ramaddr = c;
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x18000000;
-               *ramaddr = c;
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x40000000;
-       }
-#endif /* CONFIG_SYS_LSDRAM_BASE */
-
-       /* Init 60x bus SDRAM */
-#ifdef CONFIG_SPD_EEPROM
-       {
-               spd_eeprom_t spd;
-               uint pbi, bsel, rowst, lsb, tmp;
-
-               i2c_read (CONFIG_SPD_ADDR, 0, 1, (uchar *) & spd, sizeof (spd));
-
-               /* Bank-based interleaving is not supported for physical bank
-                  sizes greater than 128MB which is encoded as 0x20 in SPD
-                */
-               pbi = (spd.row_dens > 32) ? 1 : CONFIG_SDRAM_PBI;
-               msize = spd.nrows * (4 * spd.row_dens); /* Mixed size not supported */
-               or = ~(msize - 1) << 20;        /* SDAM */
-               switch (spd.nbanks) {   /* BPD */
-               case 2:
-                       bsel = 1;
-                       break;
-               case 4:
-                       bsel = 2;
-                       or |= 0x00002000;
-                       break;
-               case 8:
-                       bsel = 3;
-                       or |= 0x00004000;
-                       break;
-               }
-               lsb = 3;        /* For 64-bit port, lsb is 3 bits */
-
-               if (pbi) {      /* Bus partition depends on interleaving */
-                       rowst = 32 - (spd.nrow_addr + spd.ncol_addr + bsel + lsb);
-                       or |= (rowst << 9);     /* ROWST */
-               } else {
-                       rowst = 32 - (spd.nrow_addr + spd.ncol_addr + lsb);
-                       or |= ((rowst * 2 - 12) << 9);  /* ROWST */
-               }
-               or |= ((spd.nrow_addr - 9) << 6);       /* NUMR */
-
-               psdmr = (pbi << 31);    /* PBI */
-               /* Bus multiplexing parameters */
-               tmp = 32 - (lsb + spd.nrow_addr);       /* Tables 10-19 and 10-20 */
-               psdmr |= ((tmp - (rowst - 5) - 13) << 24);      /* SDAM */
-               psdmr |= ((tmp - 3 - 12) << 21);        /* BSMA */
-
-               tmp = (31 - lsb - 10) - tmp;
-               /* Pin connected to SDA10 is (31 - lsb - 10).
-                  rowst is multiplexed over (32 - (lsb + spd.nrow_addr)),
-                  so (rowst + tmp) alternates with AP.
-                */
-               if (pbi)                                /* Table 10-7 */
-                       psdmr |= ((10 - (rowst + tmp)) << 18);  /* SDA10 */
-               else
-                       psdmr |= ((12 - (rowst + tmp)) << 18);  /* SDA10 */
-
-               /* SDRAM device-specific parameters */
-               tmp = ns2clk (70);      /* Refresh recovery is not in SPD, so assume 70ns */
-               switch (tmp) {          /* RFRC */
-               case 1:
-               case 2:
-                       psdmr |= (1 << 15);
-                       break;
-               case 3:
-               case 4:
-               case 5:
-               case 6:
-               case 7:
-               case 8:
-                       psdmr |= ((tmp - 2) << 15);
-                       break;
-               default:
-                       psdmr |= (7 << 15);
-               }
-               psdmr |= (ns2clk (spd.trp) % 8 << 12);  /* PRETOACT */
-               psdmr |= (ns2clk (spd.trcd) % 8 << 9);  /* ACTTORW */
-               /* BL=0 because for 64-bit SDRAM burst length must be 4 */
-               /* LDOTOPRE ??? */
-               for (i = 0, tmp = spd.write_lat; (i < 4) && ((tmp & 1) == 0); i++)
-                       tmp >>= 1;
-               switch (i) {                    /* WRC */
-               case 0:
-               case 1:
-                       psdmr |= (1 << 4);
-                       break;
-               case 2:
-               case 3:
-                       psdmr |= (i << 4);
-                       break;
-               }
-               /* EAMUX=0 - no external address multiplexing */
-               /* BUFCMD=0 - no external buffers */
-               for (i = 1, tmp = spd.cas_lat; (i < 3) && ((tmp & 1) == 0); i++)
-                       tmp >>= 1;
-               psdmr |= i;                             /* CL */
-
-               switch (spd.refresh & 0x7F) {
-               case 1:
-                       tmp = 3900;
-                       break;
-               case 2:
-                       tmp = 7800;
-                       break;
-               case 3:
-                       tmp = 31300;
-                       break;
-               case 4:
-                       tmp = 62500;
-                       break;
-               case 5:
-                       tmp = 125000;
-                       break;
-               default:
-                       tmp = 15625;
-               }
-               psrt = tmp / (1000000000 / CONFIG_8260_CLKIN *
-                                 ((memctl->memc_mptpr >> 8) + 1)) - 1;
-#ifdef SPD_DEBUG
-               printf ("\nDIMM type:       %-18.18s\n", spd.mpart);
-               printf ("SPD size:        %d\n", spd.info_size);
-               printf ("EEPROM size:     %d\n", 1 << spd.chip_size);
-               printf ("Memory type:     %d\n", spd.mem_type);
-               printf ("Row addr:        %d\n", spd.nrow_addr);
-               printf ("Column addr:     %d\n", spd.ncol_addr);
-               printf ("# of rows:       %d\n", spd.nrows);
-               printf ("Row density:     %d\n", spd.row_dens);
-               printf ("# of banks:      %d\n", spd.nbanks);
-               printf ("Data width:      %d\n",
-                               256 * spd.dataw_msb + spd.dataw_lsb);
-               printf ("Chip width:      %d\n", spd.primw);
-               printf ("Refresh rate:    %02X\n", spd.refresh);
-               printf ("CAS latencies:   %02X\n", spd.cas_lat);
-               printf ("Write latencies: %02X\n", spd.write_lat);
-               printf ("tRP:             %d\n", spd.trp);
-               printf ("tRCD:            %d\n", spd.trcd);
-
-               printf ("OR=%X, PSDMR=%08X, PSRT=%0X\n", or, psdmr, psrt);
-#endif /* SPD_DEBUG */
-       }
-#else  /* !CONFIG_SPD_EEPROM */
-       or    = CONFIG_SYS_OR2;
-       psdmr = CONFIG_SYS_PSDMR;
-       psrt  = CONFIG_SYS_PSRT;
-#endif /* CONFIG_SPD_EEPROM */
-       memctl->memc_psrt = psrt;
-       memctl->memc_or2 = or;
-       memctl->memc_br2 = CONFIG_SYS_SDRAM_BASE | 0x00000041;
-       ramaddr = (uchar *) CONFIG_SYS_SDRAM_BASE;
-       memctl->memc_psdmr = psdmr | 0x28000000;        /* Precharge all banks */
-       *ramaddr = c;
-       memctl->memc_psdmr = psdmr | 0x08000000;        /* CBR refresh */
-       for (i = 0; i < 8; i++)
-               *ramaddr = c;
-
-       memctl->memc_psdmr = psdmr | 0x18000000;        /* Mode Register write */
-       *ramaddr = c;
-       memctl->memc_psdmr = psdmr | 0x40000000;        /* Refresh enable */
-       *ramaddr = c;
-#endif /* CONFIG_SYS_RAMBOOT */
-
-       /* return total 60x bus SDRAM size */
-       return (msize * 1024 * 1024);
-}
-
-int checkboard (void)
-{
-#if   CONFIG_ADSTYPE == CONFIG_SYS_8260ADS
-       puts ("Board: Motorola MPC8260ADS\n");
-#elif CONFIG_ADSTYPE == CONFIG_SYS_8266ADS
-       puts ("Board: Motorola MPC8266ADS\n");
-#elif CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS
-       puts ("Board: Motorola PQ2FADS-ZU\n");
-#elif CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-       puts ("Board: Motorola MPC8272ADS\n");
-#else
-       puts ("Board: unknown\n");
-#endif
-       return 0;
-}
-
-#ifdef CONFIG_PCI
-struct pci_controller hose;
-
-extern void pci_mpc8250_init(struct pci_controller *);
-
-void pci_init_board(void)
-{
-       pci_mpc8250_init(&hose);
-}
-#endif
-
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-void ft_board_setup(void *blob, bd_t *bd)
-{
-       ft_cpu_setup(blob, bd);
-#ifdef CONFIG_PCI
-       ft_pci_setup(blob, bd);
-#endif
-}
-#endif
index 4ee74c019883785b5cf14df09a5fc19b48e6cabb..d64d3aa872205f237fce290ae4ec0187c1ead705 100644 (file)
@@ -217,7 +217,8 @@ void ddr_ctrl_init(void)
                &ddrmr->cr[139]);
 
        writel(DDRMC_CR154_PAD_ZQ_EARLY_CMP_EN_TIMER(13) |
-               DDRMC_CR154_PAD_ZQ_MODE(1), &ddrmr->cr[154]);
+               DDRMC_CR154_PAD_ZQ_MODE(1) |
+               DDRMC_CR154_DDR_SEL_PAD_CONTR(3), &ddrmr->cr[154]);
        writel(DDRMC_CR155_AXI0_AWCACHE | DDRMC_CR155_PAD_ODT_BYTE1(2),
                &ddrmr->cr[155]);
        writel(DDRMC_CR158_TWR(6), &ddrmr->cr[158]);
diff --git a/board/hidden_dragon/Makefile b/board/hidden_dragon/Makefile
deleted file mode 100644 (file)
index eb1c5fd..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y =  hidden_dragon.o flash.o
diff --git a/board/hidden_dragon/README b/board/hidden_dragon/README
deleted file mode 100644 (file)
index 529fe2b..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-U-Boot for Hidden Dragon board
-------------------------------
-
-Hidden Dragon is a MPC824x-based board by Motorola. For the most
-part it is similar to Sandpoint8245 board. So unless otherwise
-mentioned, the codes in this directory are adapted from ../sandpoint
-directory.
-
-Apparently there are very few of this board out there. Even Motorola
-website does not have any info on it.
-
-RAM:
-  start = 0x0000 0000
-  size = 0x0200 0000 (32 MB)
-
-Flash:
-  BANK ONE:
-    start = 0xFFE0 0000
-    size  = 0x0020 0000 (2 MB)
-    flash chip = 29LV160TE (1x16 Mbits or 2x8 Mbits)
-    flash sectors = 16K, 2x8K, 32K, 31x64K
-
-  BANK TWO:
-    NONE
-
-The processor interrupt vectors reside on the first 256 bytes
-starting from address 0xFFF00000. The "reset vector" (first
-instruction executed after reset) is located on 0xFFF0 0100.
-
-U-Boot is configured to reside in flash starting at the address of
-0xFFF00000. The environment space is located in flash separately from
-U-Boot, at the second sector of the first flash bank, starting from
-0xFFE04000 until 0xFFE06000 (8KB).
-
-Network:
-  - RTL8139 chip on the base board       (SUPPORTED)
-  - RTL8129 chip on the processor board          (NOT SUPPORTED)
-
-Serial:
-  - Two NS16550 compatible UART on the processor board (SUPPORTED)
-  - One NS16550 compatible UART on the base board      (UNTESTED)
-
-Misc:
-  VIA686A PCI SuperIO peripheral controller
-  - 2 USB ports                    (UNTESTED)
-  - 2 PS2 ports                    (UNTESTED)
-  - Parallel port          (UNTESTED)
-  - IDE & floppy interface  (UNTESTED)
-
-  S3 Savage4 video card            (UNTESTED)
-
-TODO:
------
-- Support for the VIA686A based peripherals
-- The RTL8139 driver frequently gives rx error.
-- Support for RTL8129 network controller. (Why is the support removed from
-  rtl8139.c driver?)
-
-(C) Copyright 2004
-Yusdi Santoso, Adaptec Inc., yusdi_santoso@adaptec.com
diff --git a/board/hidden_dragon/flash.c b/board/hidden_dragon/flash.c
deleted file mode 100644 (file)
index fc91a03..0000000
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- * (C) Copyright 2004
- * Yusdi Santoso, Adaptec Inc., yusdi_santoso@adaptec.com
- *
- * (C) Copyright 2000-2005
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc824x.h>
-#include <asm/processor.h>
-#include <asm/pci_io.h>
-#include <w83c553f.h>
-
-#define ROM_CS0_START  0xFF800000
-#define ROM_CS1_START  0xFF000000
-
-flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH chips    */
-
-#if defined(CONFIG_ENV_IS_IN_FLASH)
-# ifndef  CONFIG_ENV_ADDR
-#  define CONFIG_ENV_ADDR  (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)
-# endif
-# ifndef  CONFIG_ENV_SIZE
-#  define CONFIG_ENV_SIZE  CONFIG_ENV_SECT_SIZE
-# endif
-# ifndef  CONFIG_ENV_SECT_SIZE
-#  define CONFIG_ENV_SECT_SIZE  CONFIG_ENV_SIZE
-# endif
-#endif
-
-/*-----------------------------------------------------------------------
- * Functions
- */
-static int write_word (flash_info_t *info, ulong dest, ulong data);
-
-/*flash command address offsets*/
-
-#define ADDR0          (0xAAA)
-#define ADDR1          (0x555)
-#define ADDR3          (0x001)
-
-#define FLASH_WORD_SIZE unsigned char
-
-/*-----------------------------------------------------------------------
- */
-
-static unsigned long flash_id (unsigned char mfct, unsigned char chip)
-       __attribute__ ((const));
-
-typedef struct {
-       FLASH_WORD_SIZE extval;
-       unsigned short intval;
-} map_entry;
-
-static unsigned long flash_id (unsigned char mfct, unsigned char chip)
-{
-       static const map_entry mfct_map[] = {
-               {(FLASH_WORD_SIZE) AMD_MANUFACT,
-                (unsigned short) ((unsigned long) FLASH_MAN_AMD >> 16)},
-               {(FLASH_WORD_SIZE) FUJ_MANUFACT,
-                (unsigned short) ((unsigned long) FLASH_MAN_FUJ >> 16)},
-               {(FLASH_WORD_SIZE) STM_MANUFACT,
-                (unsigned short) ((unsigned long) FLASH_MAN_STM >> 16)},
-               {(FLASH_WORD_SIZE) MT_MANUFACT,
-                (unsigned short) ((unsigned long) FLASH_MAN_MT >> 16)},
-               {(FLASH_WORD_SIZE) INTEL_MANUFACT,
-                (unsigned short) ((unsigned long) FLASH_MAN_INTEL >> 16)},
-               {(FLASH_WORD_SIZE) INTEL_ALT_MANU,
-                (unsigned short) ((unsigned long) FLASH_MAN_INTEL >> 16)}
-       };
-
-       static const map_entry chip_map[] = {
-               {AMD_ID_F040B, FLASH_AM040},
-               {(FLASH_WORD_SIZE) STM_ID_x800AB, FLASH_STM800AB}
-       };
-
-       const map_entry *p;
-       unsigned long result = FLASH_UNKNOWN;
-
-       /* find chip id */
-       for (p = &chip_map[0];
-            p < &chip_map[sizeof chip_map / sizeof chip_map[0]]; p++)
-               if (p->extval == chip) {
-                       result = FLASH_VENDMASK | p->intval;
-                       break;
-               }
-
-       /* find vendor id */
-       for (p = &mfct_map[0];
-            p < &mfct_map[sizeof mfct_map / sizeof mfct_map[0]]; p++)
-               if (p->extval == mfct) {
-                       result &= ~FLASH_VENDMASK;
-                       result |= (unsigned long) p->intval << 16;
-                       break;
-               }
-
-       return result;
-}
-
-unsigned long flash_init (void)
-{
-       unsigned long i;
-       unsigned char j;
-       static const ulong flash_banks[] = CONFIG_SYS_FLASH_BANKS;
-
-       /* Init: no FLASHes known */
-       for (i = 0; i < CONFIG_SYS_MAX_FLASH_BANKS; i++) {
-               flash_info_t *const pflinfo = &flash_info[i];
-
-               pflinfo->flash_id = FLASH_UNKNOWN;
-               pflinfo->size = 0;
-               pflinfo->sector_count = 0;
-       }
-
-       /* Enable writes to Hidden Dragon flash */
-       {
-               register unsigned char temp;
-
-               CONFIG_READ_BYTE (CONFIG_SYS_WINBOND_ISA_CFG_ADDR + WINBOND_CSCR,
-                                 temp);
-               temp &= ~0x20;  /* clear BIOSWP bit */
-               CONFIG_WRITE_BYTE (CONFIG_SYS_WINBOND_ISA_CFG_ADDR + WINBOND_CSCR,
-                                  temp);
-       }
-
-       for (i = 0; i < sizeof flash_banks / sizeof flash_banks[0]; i++) {
-               flash_info_t *const pflinfo = &flash_info[i];
-               const unsigned long base_address = flash_banks[i];
-               volatile FLASH_WORD_SIZE *const flash =
-                       (FLASH_WORD_SIZE *) base_address;
-
-               flash[0xAAA << (3 * i)] = 0xaa;
-               flash[0x555 << (3 * i)] = 0x55;
-               flash[0xAAA << (3 * i)] = 0x90;
-               __asm__ __volatile__ ("sync");
-
-               pflinfo->flash_id =
-                       flash_id (flash[0x0], flash[0x2 + 14 * i]);
-
-               switch (pflinfo->flash_id & FLASH_TYPEMASK) {
-               case FLASH_AM040:
-                       pflinfo->size = 0x00080000;
-                       pflinfo->sector_count = 8;
-                       for (j = 0; j < 8; j++) {
-                               pflinfo->start[j] =
-                                       base_address + 0x00010000 * j;
-                               pflinfo->protect[j] = flash[(j << 16) | 0x2];
-                       }
-                       break;
-               case FLASH_STM800AB:
-                       pflinfo->size = 0x00100000;
-                       pflinfo->sector_count = 19;
-                       pflinfo->start[0] = base_address;
-                       pflinfo->start[1] = base_address + 0x4000;
-                       pflinfo->start[2] = base_address + 0x6000;
-                       pflinfo->start[3] = base_address + 0x8000;
-                       for (j = 1; j < 16; j++) {
-                               pflinfo->start[j + 3] =
-                                       base_address + 0x00010000 * j;
-                       }
-                       break;
-               default:
-                       /* The chip used is not listed in flash_id
-                          TODO: Change this to explicitly detect the flash type
-                        */
-                       {
-                               int sector_addr = base_address;
-
-                               pflinfo->size = 0x00200000;
-                               pflinfo->sector_count = 35;
-                               pflinfo->start[0] = sector_addr;
-                               sector_addr += 0x4000;  /* 16K */
-                               pflinfo->start[1] = sector_addr;
-                               sector_addr += 0x2000;  /* 8K */
-                               pflinfo->start[2] = sector_addr;
-                               sector_addr += 0x2000;  /* 8K */
-                               pflinfo->start[3] = sector_addr;
-                               sector_addr += 0x8000;  /* 32K */
-
-                               for (j = 4; j < 35; j++) {
-                                       pflinfo->start[j] = sector_addr;
-                                       sector_addr += 0x10000; /* 64K */
-                               }
-                       }
-                       break;
-               }
-               /* Protect monitor and environment sectors
-                */
-#if CONFIG_SYS_MONITOR_BASE >= CONFIG_SYS_FLASH_BASE
-               flash_protect (FLAG_PROTECT_SET,
-                              CONFIG_SYS_MONITOR_BASE,
-                              CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1,
-                              &flash_info[0]);
-#endif
-
-#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
-               flash_protect (FLAG_PROTECT_SET,
-                              CONFIG_ENV_ADDR,
-                              CONFIG_ENV_ADDR + CONFIG_ENV_SIZE - 1,
-                              &flash_info[0]);
-#endif
-
-               /* reset device to read mode */
-               flash[0x0000] = 0xf0;
-               __asm__ __volatile__ ("sync");
-       }
-
-       /* only have 1 bank */
-       return flash_info[0].size;
-}
-
-/*-----------------------------------------------------------------------
- */
-void flash_print_info (flash_info_t * info)
-{
-       static const char unk[] = "Unknown";
-       const char *mfct = unk, *type = unk;
-       unsigned int i;
-
-       if (info->flash_id != FLASH_UNKNOWN) {
-               switch (info->flash_id & FLASH_VENDMASK) {
-               case FLASH_MAN_AMD:
-                       mfct = "AMD";
-                       break;
-               case FLASH_MAN_FUJ:
-                       mfct = "FUJITSU";
-                       break;
-               case FLASH_MAN_STM:
-                       mfct = "STM";
-                       break;
-               case FLASH_MAN_SST:
-                       mfct = "SST";
-                       break;
-               case FLASH_MAN_BM:
-                       mfct = "Bright Microelectonics";
-                       break;
-               case FLASH_MAN_INTEL:
-                       mfct = "Intel";
-                       break;
-               }
-
-               switch (info->flash_id & FLASH_TYPEMASK) {
-               case FLASH_AM040:
-                       type = "AM29F040B (512K * 8, uniform sector size)";
-                       break;
-               case FLASH_AM400B:
-                       type = "AM29LV400B (4 Mbit, bottom boot sect)";
-                       break;
-               case FLASH_AM400T:
-                       type = "AM29LV400T (4 Mbit, top boot sector)";
-                       break;
-               case FLASH_AM800B:
-                       type = "AM29LV800B (8 Mbit, bottom boot sect)";
-                       break;
-               case FLASH_AM800T:
-                       type = "AM29LV800T (8 Mbit, top boot sector)";
-                       break;
-               case FLASH_AM160T:
-                       type = "AM29LV160T (16 Mbit, top boot sector)";
-                       break;
-               case FLASH_AM320B:
-                       type = "AM29LV320B (32 Mbit, bottom boot sect)";
-                       break;
-               case FLASH_AM320T:
-                       type = "AM29LV320T (32 Mbit, top boot sector)";
-                       break;
-               case FLASH_STM800AB:
-                       type = "M29W800AB (8 Mbit, bottom boot sect)";
-                       break;
-               case FLASH_SST800A:
-                       type = "SST39LF/VF800 (8 Mbit, uniform sector size)";
-                       break;
-               case FLASH_SST160A:
-                       type = "SST39LF/VF160 (16 Mbit, uniform sector size)";
-                       break;
-               }
-       }
-
-       printf ("\n  Brand: %s Type: %s\n"
-               "  Size: %lu KB in %d Sectors\n",
-               mfct, type, info->size >> 10, info->sector_count);
-
-       printf ("  Sector Start Addresses:");
-
-       for (i = 0; i < info->sector_count; i++) {
-               unsigned long size;
-               unsigned int erased;
-               unsigned long *flash = (unsigned long *) info->start[i];
-
-               /*
-                * Check if whole sector is erased
-                */
-               size = (i != (info->sector_count - 1)) ?
-                       (info->start[i + 1] - info->start[i]) >> 2 :
-                       (info->start[0] + info->size - info->start[i]) >> 2;
-
-               for (flash = (unsigned long *) info->start[i], erased = 1;
-                    (flash != (unsigned long *) info->start[i] + size)
-                    && erased; flash++)
-                       erased = *flash == ~0x0UL;
-
-               printf ("%s %08lX %s %s",
-                       (i % 5) ? "" : "\n   ",
-                       info->start[i],
-                       erased ? "E" : " ", info->protect[i] ? "RO" : "  ");
-       }
-
-       puts ("\n");
-       return;
-}
-
-int flash_erase (flash_info_t * info, int s_first, int s_last)
-{
-       volatile FLASH_WORD_SIZE *addr = (FLASH_WORD_SIZE *) (info->start[0]);
-       int flag, prot, sect, l_sect;
-       ulong start, now, last;
-       unsigned char sh8b;
-
-       if ((s_first < 0) || (s_first > s_last)) {
-               if (info->flash_id == FLASH_UNKNOWN) {
-                       printf ("- missing\n");
-               } else {
-                       printf ("- no sectors to erase\n");
-               }
-               return 1;
-       }
-
-       if ((info->flash_id == FLASH_UNKNOWN) ||
-           (info->flash_id > (FLASH_MAN_STM | FLASH_AMD_COMP))) {
-               printf ("Can't erase unknown flash type - aborted\n");
-               return 1;
-       }
-
-       prot = 0;
-       for (sect = s_first; sect <= s_last; ++sect) {
-               if (info->protect[sect]) {
-                       prot++;
-               }
-       }
-
-       if (prot) {
-               printf ("- Warning: %d protected sectors will not be erased!\n", prot);
-       } else {
-               printf ("\n");
-       }
-
-       l_sect = -1;
-
-       /* Check the ROM CS */
-       if ((info->start[0] >= ROM_CS1_START)
-           && (info->start[0] < ROM_CS0_START))
-               sh8b = 3;
-       else
-               sh8b = 0;
-
-       /* Disable interrupts which might cause a timeout here */
-       flag = disable_interrupts ();
-
-       addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE) 0x00AA00AA;
-       addr[ADDR1 << sh8b] = (FLASH_WORD_SIZE) 0x00550055;
-       addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE) 0x00800080;
-       addr[ADDR0 << sh8b] = (FLASH_WORD_SIZE) 0x00AA00AA;
-       addr[ADDR1 << sh8b] = (FLASH_WORD_SIZE) 0x00550055;
-
-       /* Start erase on unprotected sectors */
-       for (sect = s_first; sect <= s_last; sect++) {
-               if (info->protect[sect] == 0) { /* not protected */
-                       addr = (FLASH_WORD_SIZE *) (info->start[0] +
-                                                   ((info->start[sect] -
-                                                     info->start[0]) << sh8b));
-                       if (info->flash_id & FLASH_MAN_SST) {
-                               addr[ADDR0 << sh8b] =
-                                       (FLASH_WORD_SIZE) 0x00AA00AA;
-                               addr[ADDR1 << sh8b] =
-                                       (FLASH_WORD_SIZE) 0x00550055;
-                               addr[ADDR0 << sh8b] =
-                                       (FLASH_WORD_SIZE) 0x00800080;
-                               addr[ADDR0 << sh8b] =
-                                       (FLASH_WORD_SIZE) 0x00AA00AA;
-                               addr[ADDR1 << sh8b] =
-                                       (FLASH_WORD_SIZE) 0x00550055;
-                               addr[0] = (FLASH_WORD_SIZE) 0x00500050; /* block erase */
-                               udelay (30000); /* wait 30 ms */
-                       } else
-                               addr[0] = (FLASH_WORD_SIZE) 0x00300030; /* sector erase */
-                       l_sect = sect;
-               }
-       }
-
-       /* re-enable interrupts if necessary */
-       if (flag)
-               enable_interrupts ();
-
-       /* wait at least 80us - let's wait 1 ms */
-       udelay (1000);
-
-       /*
-        * We wait for the last triggered sector
-        */
-       if (l_sect < 0)
-               goto DONE;
-
-       start = get_timer (0);
-       last = start;
-       addr = (FLASH_WORD_SIZE *) (info->start[0] + ((info->start[l_sect] -
-                                                      info->
-                                                      start[0]) << sh8b));
-       while ((addr[0] & (FLASH_WORD_SIZE) 0x00800080) !=
-              (FLASH_WORD_SIZE) 0x00800080) {
-               if ((now = get_timer (start)) > CONFIG_SYS_FLASH_ERASE_TOUT) {
-                       printf ("Timeout\n");
-                       return 1;
-               }
-               /* show that we're waiting */
-               if ((now - last) > 1000) {      /* every second */
-                       serial_putc ('.');
-                       last = now;
-               }
-       }
-
-      DONE:
-       /* reset to read mode */
-       addr = (FLASH_WORD_SIZE *) info->start[0];
-       addr[0] = (FLASH_WORD_SIZE) 0x00F000F0; /* reset bank */
-
-       printf (" done\n");
-       return 0;
-}
-
-/*-----------------------------------------------------------------------
- * Copy memory to flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-
-int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
-{
-       ulong cp, wp, data;
-       int i, l, rc;
-
-       wp = (addr & ~3);       /* get lower word aligned address */
-
-       /*
-        * handle unaligned start bytes
-        */
-       if ((l = addr - wp) != 0) {
-               data = 0;
-               for (i = 0, cp = wp; i < l; ++i, ++cp) {
-                       data = (data << 8) | (*(uchar *) cp);
-               }
-               for (; i < 4 && cnt > 0; ++i) {
-                       data = (data << 8) | *src++;
-                       --cnt;
-                       ++cp;
-               }
-               for (; cnt == 0 && i < 4; ++i, ++cp) {
-                       data = (data << 8) | (*(uchar *) cp);
-               }
-
-               if ((rc = write_word (info, wp, data)) != 0) {
-                       return (rc);
-               }
-               wp += 4;
-       }
-
-       /*
-        * handle word aligned part
-        */
-       while (cnt >= 4) {
-               data = 0;
-               for (i = 0; i < 4; ++i) {
-                       data = (data << 8) | *src++;
-               }
-               if ((rc = write_word (info, wp, data)) != 0) {
-                       return (rc);
-               }
-               wp += 4;
-               cnt -= 4;
-       }
-
-       if (cnt == 0) {
-               return (0);
-       }
-
-       /*
-        * handle unaligned tail bytes
-        */
-       data = 0;
-       for (i = 0, cp = wp; i < 4 && cnt > 0; ++i, ++cp) {
-               data = (data << 8) | *src++;
-               --cnt;
-       }
-       for (; i < 4; ++i, ++cp) {
-               data = (data << 8) | (*(uchar *) cp);
-       }
-
-       return (write_word (info, wp, data));
-}
-
-/*-----------------------------------------------------------------------
- * Write a word to Flash, returns:
- * 0 - OK
- * 1 - write timeout
- * 2 - Flash not erased
- */
-static int write_word (flash_info_t * info, ulong dest, ulong data)
-{
-       volatile FLASH_WORD_SIZE *addr2 = (FLASH_WORD_SIZE *) info->start[0];
-       volatile FLASH_WORD_SIZE *dest2;
-       volatile FLASH_WORD_SIZE *data2 = (FLASH_WORD_SIZE *) & data;
-       ulong start;
-       int flag;
-       int i;
-       unsigned char sh8b;
-
-       /* Check the ROM CS */
-       if ((info->start[0] >= ROM_CS1_START)
-           && (info->start[0] < ROM_CS0_START))
-               sh8b = 3;
-       else
-               sh8b = 0;
-
-       dest2 = (FLASH_WORD_SIZE *) (((dest - info->start[0]) << sh8b) +
-                                    info->start[0]);
-
-       /* Check if Flash is (sufficiently) erased */
-       if ((*dest2 & (FLASH_WORD_SIZE) data) != (FLASH_WORD_SIZE) data) {
-               return (2);
-       }
-       /* Disable interrupts which might cause a timeout here */
-       flag = disable_interrupts ();
-
-       for (i = 0; i < 4 / sizeof (FLASH_WORD_SIZE); i++) {
-               addr2[ADDR0 << sh8b] = (FLASH_WORD_SIZE) 0x00AA00AA;
-               addr2[ADDR1 << sh8b] = (FLASH_WORD_SIZE) 0x00550055;
-               addr2[ADDR0 << sh8b] = (FLASH_WORD_SIZE) 0x00A000A0;
-
-               dest2[i << sh8b] = data2[i];
-
-               /* re-enable interrupts if necessary */
-               if (flag)
-                       enable_interrupts ();
-
-               /* data polling for D7 */
-               start = get_timer (0);
-               while ((dest2[i << sh8b] & (FLASH_WORD_SIZE) 0x00800080) !=
-                      (data2[i] & (FLASH_WORD_SIZE) 0x00800080)) {
-                       if (get_timer (start) > CONFIG_SYS_FLASH_WRITE_TOUT) {
-                               return (1);
-                       }
-               }
-       }
-
-       return (0);
-}
diff --git a/board/hidden_dragon/hidden_dragon.c b/board/hidden_dragon/hidden_dragon.c
deleted file mode 100644 (file)
index 8d47f37..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * (C) Copyright 2004
- * Yusdi Santoso, Adaptec Inc., yusdi_santoso@adaptec.com
- *
- * (C) Copyright 2000
- * Rob Taylor, Flying Pig Systems. robt@flyingpig.com.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc824x.h>
-#include <pci.h>
-#include <netdev.h>
-
-int checkboard (void)
-{
-       /*TODO: Check processor type */
-
-       puts (  "Board: Hidden Dragon "
-#ifdef CONFIG_MPC8240
-               "8240"
-#endif
-#ifdef CONFIG_MPC8245
-               "8245"
-#endif
-               " ##Test not implemented yet##\n");
-       /* TODO: Implement board test */
-       return 0;
-}
-
-phys_size_t initdram (int board_type)
-{
-       long size;
-       long new_bank0_end;
-       long mear1;
-       long emear1;
-
-       size = get_ram_size(CONFIG_SYS_SDRAM_BASE, CONFIG_SYS_MAX_RAM_SIZE);
-
-       new_bank0_end = size - 1;
-       mear1 = mpc824x_mpc107_getreg(MEAR1);
-       emear1 = mpc824x_mpc107_getreg(EMEAR1);
-       mear1 = (mear1  & 0xFFFFFF00) |
-               ((new_bank0_end & MICR_ADDR_MASK) >> MICR_ADDR_SHIFT);
-       emear1 = (emear1 & 0xFFFFFF00) |
-               ((new_bank0_end & MICR_ADDR_MASK) >> MICR_EADDR_SHIFT);
-       mpc824x_mpc107_setreg(MEAR1, mear1);
-       mpc824x_mpc107_setreg(EMEAR1, emear1);
-
-       return (size);
-}
-
-/*
- * Initialize PCI Devices, report devices found.
- */
-#ifndef CONFIG_PCI_PNP
-static struct pci_config_table pci_hidden_dragon_config_table[] = {
-       { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x0f, PCI_ANY_ID,
-         pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
-                                      PCI_ENET0_MEMADDR,
-                                      PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
-       { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0x10, PCI_ANY_ID,
-         pci_cfgfunc_config_device, { PCI_ENET1_IOADDR,
-                                      PCI_ENET1_MEMADDR,
-                                      PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER }},
-       { }
-};
-#endif
-
-struct pci_controller hose = {
-#ifndef CONFIG_PCI_PNP
-       config_table: pci_hidden_dragon_config_table,
-#endif
-};
-
-void pci_init_board(void)
-{
-       pci_mpc824x_init(&hose);
-}
-
-int board_eth_init(bd_t *bis)
-{
-       return pci_eth_init(bis);
-}
index 5fec914f5ad525c6f519b10fd315af3670d980f7..0183f781dec43dffe706f345de0d59ef846d0a07 100644 (file)
@@ -8,6 +8,8 @@
  */
 
 #include <common.h>
+#include <bootretry.h>
+#include <cli.h>
 #include <mpc8260.h>
 #include <mpc8260_irq.h>
 #include <ioports.h>
@@ -413,13 +415,11 @@ last_stage_init (void)
        hymod_conf_t *cp = &gd->bd->bi_hymod_conf;
        int rc;
 
-#ifdef CONFIG_BOOT_RETRY_TIME
        /*
-        * we use the readline () function, but we also want
+        * we use the cli_readline() function, but we also want
         * command timeout enabled
         */
-       init_cmd_timeout ();
-#endif
+       bootretry_init_cmd_timeout();
 
        memset ((void *) cp, 0, sizeof (*cp));
 
index 184902cde5764b151ddab88cea4dd62384023ae9..a9035d340591042d4113b1af0b3019b53d3f8e9d 100644 (file)
@@ -6,6 +6,8 @@
  */
 
 #include <common.h>
+#include <bootretry.h>
+#include <cli.h>
 
 int
 hymod_get_serno (const char *prompt)
@@ -14,11 +16,9 @@ hymod_get_serno (const char *prompt)
                int n, serno;
                char *p;
 
-#ifdef CONFIG_BOOT_RETRY_TIME
-               reset_cmd_timeout ();
-#endif
+               bootretry_reset_cmd_timeout();
 
-               n = readline (prompt);
+               n = cli_readline(prompt);
 
                if (n < 0)
                        return (n);
@@ -42,11 +42,9 @@ hymod_get_ethaddr (void)
        for (;;) {
                int n;
 
-#ifdef CONFIG_BOOT_RETRY_TIME
-               reset_cmd_timeout ();
-#endif
+               bootretry_reset_cmd_timeout();
 
-               n = readline ("Enter board ethernet address: ");
+               n = cli_readline("Enter board ethernet address: ");
 
                if (n < 0)
                        return (n);
diff --git a/board/ispan/Makefile b/board/ispan/Makefile
deleted file mode 100644 (file)
index 39931fd..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# (C) Copyright 2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# Copyright (C) 2004 Arabella Software Ltd.
-# Yuli Barcohen <yuli@arabellasw.com>
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  := ispan.o
diff --git a/board/ispan/ispan.c b/board/ispan/ispan.c
deleted file mode 100644 (file)
index c610c3b..0000000
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Copyright (C) 2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * Support for Interphase iSPAN Communications Controllers
- * (453x and others). Tested on 4532.
- *
- * Derived from iSPAN 4539 port (iphase4539) by
- * Wolfgang Grandegger <wg@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <ioports.h>
-#include <mpc8260.h>
-#include <asm/io.h>
-
-/*
- * I/O Ports configuration table
- *
- * If conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-#define CONFIG_SYS_FCC1 (CONFIG_ETHER_INDEX == 1)
-#define CONFIG_SYS_FCC2 (CONFIG_ETHER_INDEX == 2)
-#define CONFIG_SYS_FCC3 (CONFIG_ETHER_INDEX == 3)
-
-const iop_conf_t iop_conf_tab[4][32] = {
-    /* Port A */
-    {  /*            conf      ppar psor pdir podr pdat */
-       /* PA31 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII COL   */
-       /* PA30 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII CRS   */
-       /* PA29 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_ER */
-       /* PA28 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_EN */
-       /* PA27 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_DV */
-       /* PA26 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_ER */
-       /* PA25 */ { 0,          0,   0,   0,   0,   0 }, /* PA25 */
-       /* PA24 */ { 0,          0,   0,   0,   0,   0 }, /* PA24 */
-       /* PA23 */ { 0,          0,   0,   0,   0,   0 }, /* PA23 */
-       /* PA22 */ { 0,          0,   0,   0,   0,   0 }, /* PA22 */
-       /* PA21 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[3] */
-       /* PA20 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[2] */
-       /* PA19 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[1] */
-       /* PA18 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[0] */
-       /* PA17 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[0] */
-       /* PA16 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[1] */
-       /* PA15 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[2] */
-       /* PA14 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[3] */
-       /* PA13 */ { 0,          0,   0,   0,   0,   0 }, /* PA13 */
-       /* PA12 */ { 0,          0,   0,   0,   0,   0 }, /* PA12 */
-       /* PA11 */ { 0,          0,   0,   0,   0,   0 }, /* PA11 */
-       /* PA10 */ { 0,          0,   0,   0,   0,   0 }, /* PA10 */
-       /* PA9  */ { 0,          1,   0,   1,   0,   0 }, /* SMC2 SMTXD */
-       /* PA8  */ { 0,          1,   0,   0,   0,   0 }, /* SMC2 SMRXD */
-       /* PA7  */ { 0,          0,   0,   0,   0,   0 }, /* PA7 */
-       /* PA6  */ { 0,          0,   0,   0,   0,   0 }, /* PA6 */
-       /* PA5  */ { 0,          0,   0,   0,   0,   0 }, /* PA5 */
-       /* PA4  */ { 0,          0,   0,   0,   0,   0 }, /* PA4 */
-       /* PA3  */ { 0,          0,   0,   0,   0,   0 }, /* PA3 */
-       /* PA2  */ { 0,          0,   0,   0,   0,   0 }, /* PA2 */
-       /* PA1  */ { 0,          0,   0,   0,   0,   0 }, /* PA1 */
-       /* PA0  */ { 0,          0,   0,   0,   0,   0 }  /* PA0 */
-    },
-
-    /* Port B */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PB31 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TX_ER  */
-       /* PB30 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_DV  */
-       /* PB29 */ { CONFIG_SYS_FCC2,   1,   1,   1,   0,   0 }, /* FCC2 MII TX_EN  */
-       /* PB28 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_ER  */
-       /* PB27 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII COL    */
-       /* PB26 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII CRS    */
-       /* PB25 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[3] */
-       /* PB24 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[2] */
-       /* PB23 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[1] */
-       /* PB22 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[0] */
-       /* PB21 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[0] */
-       /* PB20 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[1] */
-       /* PB19 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[2] */
-       /* PB18 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[3] */
-       /* PB17 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII RX_DV  */
-       /* PB16 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII RX_ER  */
-       /* PB15 */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3 MII TX_ER  */
-       /* PB14 */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3 MII TX_EN  */
-       /* PB13 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII COL    */
-       /* PB12 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII CRS    */
-       /* PB11 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII RxD[3] */
-       /* PB10 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII RxD[2] */
-       /* PB9  */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII RxD[1] */
-       /* PB8  */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII RxD[0] */
-       /* PB7  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3 MII TxD[0] */
-       /* PB6  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3 MII TxD[1] */
-       /* PB5  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3 MII TxD[2] */
-       /* PB4  */ { CONFIG_SYS_FCC3,   1,   0,   1,   0,   0 }, /* FCC3 MII TxD[3] */
-       /* PB3  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PB2  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PB1  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PB0  */ { 0,          0,   0,   0,   0,   0 }  /* pin doesn't exist */
-    },
-
-    /* Port C */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PC31 */ { 0,          0,   0,   0,   0,   0 }, /* PC31 */
-       /* PC30 */ { 0,          0,   0,   0,   0,   0 }, /* PC30 */
-       /* PC29 */ { 0,          0,   0,   0,   0,   0 }, /* PC29 */
-       /* PC28 */ { 0,          0,   0,   0,   0,   0 }, /* PC28 */
-       /* PC27 */ { 0,          0,   0,   0,   0,   0 }, /* PC27 */
-       /* PC26 */ { 0,          0,   0,   0,   0,   0 }, /* PC26 */
-       /* PC25 */ { 0,          0,   0,   0,   0,   0 }, /* PC25 */
-       /* PC24 */ { 0,          0,   0,   0,   0,   0 }, /* PC24 */
-       /* PC23 */ { 0,          0,   0,   0,   0,   0 }, /* PC23 */
-       /* PC22 */ { 0,          0,   0,   0,   0,   0 }, /* PC22 */
-       /* PC21 */ { 0,          0,   0,   0,   0,   0 }, /* PC21 */
-       /* PC20 */ { 0,          0,   0,   0,   0,   0 }, /* PC20 */
-       /* PC19 */ { 0,          0,   0,   0,   0,   0 }, /* PC19 */
-       /* PC18 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII Rx Clock (CLK14) */
-       /* PC17 */ { 0,          0,   0,   0,   0,   0 }, /* PC17 */
-       /* PC16 */ { CONFIG_SYS_FCC3,   1,   0,   0,   0,   0 }, /* FCC3 MII Tx Clock (CLK16) */
-       /* PC15 */ { 0,          0,   0,   0,   0,   0 }, /* PC15 */
-       /* PC14 */ { 0,          0,   0,   0,   0,   0 }, /* PC14 */
-       /* PC13 */ { 0,          0,   0,   0,   0,   0 }, /* PC13 */
-       /* PC12 */ { 0,          0,   0,   0,   0,   0 }, /* PC12 */
-       /* PC11 */ { 0,          0,   0,   0,   0,   0 }, /* PC11 */
-       /* PC10 */ { 0,          0,   0,   0,   0,   0 }, /* PC10 */
-       /* PC9  */ { 0,          0,   0,   0,   0,   0 }, /* PC9  */
-       /* PC8  */ { 0,          0,   0,   0,   0,   0 }, /* PC8  */
-       /* PC7  */ { 0,          0,   0,   0,   0,   0 }, /* PC7  */
-       /* PC6  */ { 0,          0,   0,   0,   0,   0 }, /* PC6  */
-       /* PC5  */ { 0,          0,   0,   0,   0,   0 }, /* PC5  */
-       /* PC4  */ { 0,          0,   0,   0,   0,   0 }, /* PC4  */
-       /* PC3  */ { 0,          0,   0,   0,   0,   0 }, /* PC3  */
-       /* PC2  */ { 0,          0,   0,   0,   0,   0 }, /* PC2  */
-       /* PC1  */ { 0,          0,   0,   0,   0,   0 }, /* PC1  */
-       /* PC0  */ { 0,          0,   0,   0,   0,   0 }  /* PC0  */
-    },
-
-    /* Port D */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PD31 */ { 0,          0,   0,   0,   0,   0 }, /* PD31 */
-       /* PD30 */ { 0,          0,   0,   0,   0,   0 }, /* PD30 */
-       /* PD29 */ { 0,          0,   0,   0,   0,   0 }, /* PD29 */
-       /* PD28 */ { 0,          0,   0,   0,   0,   0 }, /* PD28 */
-       /* PD27 */ { 0,          0,   0,   0,   0,   0 }, /* PD27 */
-       /* PD26 */ { 0,          0,   0,   0,   0,   0 }, /* PD26 */
-       /* PD25 */ { 0,          0,   0,   0,   0,   0 }, /* PD25 */
-       /* PD24 */ { 0,          0,   0,   0,   0,   0 }, /* PD24 */
-       /* PD23 */ { 0,          0,   0,   0,   0,   0 }, /* PD23 */
-       /* PD22 */ { 0,          0,   0,   0,   0,   0 }, /* PD22 */
-       /* PD21 */ { 0,          0,   0,   0,   0,   0 }, /* PD21 */
-       /* PD20 */ { 0,          0,   0,   0,   0,   0 }, /* PD20 */
-       /* PD19 */ { 0,          0,   0,   0,   0,   0 }, /* PD19 */
-       /* PD18 */ { 0,          1,   1,   0,   0,   0 }, /* SPICLK  */
-       /* PD17 */ { 0,          1,   1,   0,   0,   0 }, /* SPIMOSI */
-       /* PD16 */ { 0,          1,   1,   0,   0,   0 }, /* SPIMISO */
-       /* PD15 */ { 0,          1,   1,   0,   1,   0 }, /* I2C SDA */
-       /* PD14 */ { 0,          1,   1,   0,   1,   0 }, /* I2C SCL */
-       /* PD13 */ { 1,          0,   0,   0,   0,   0 }, /* MII MDIO */
-       /* PD12 */ { 1,          0,   0,   1,   0,   0 }, /* MII MDC  */
-       /* PD11 */ { 0,          0,   0,   0,   0,   0 }, /* PD11 */
-       /* PD10 */ { 0,          0,   0,   0,   0,   0 }, /* PD10 */
-       /* PD9  */ { 1,          1,   0,   1,   0,   0 }, /* SMC1 SMTXD */
-       /* PD8  */ { 1,          1,   0,   0,   0,   0 }, /* SMC1 SMRXD */
-       /* PD7  */ { 0,          0,   0,   0,   0,   0 }, /* PD7 */
-       /* PD6  */ { CONFIG_SYS_FCC3,   0,   0,   1,   0,   1 }, /* MII PHY Reset  */
-       /* PD5  */ { CONFIG_SYS_FCC3,   0,   0,   1,   0,   0 }, /* MII PHY Enable */
-       /* PD4  */ { 0,          0,   0,   0,   0,   0 }, /* PD4 */
-       /* PD3  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PD2  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PD1  */ { 0,          0,   0,   0,   0,   0 }, /* pin doesn't exist */
-       /* PD0  */ { 0,          0,   0,   0,   0,   0 }  /* pin doesn't exist */
-    }
-};
-
-#define PSPAN_ADDR      0xF0020000
-#define EEPROM_REG      0x408
-#define EEPROM_READ_CMD 0xA000
-#define PSPAN_WRITE(a,v) \
-    *((volatile unsigned long *)(PSPAN_ADDR+(a))) = v; eieio()
-#define PSPAN_READ(a) \
-    *((volatile unsigned long *)(PSPAN_ADDR+(a)))
-
-static int seeprom_read (int addr, uchar * data, int size)
-{
-       ulong val, cmd;
-       int i;
-
-       for (i = 0; i < size; i++) {
-
-               cmd = EEPROM_READ_CMD;
-               cmd |= ((addr + i) << 24) & 0xff000000;
-
-               /* Wait for ACT to authorize write */
-               while ((val = PSPAN_READ (EEPROM_REG)) & 0x80)
-                       eieio ();
-
-               /* Write command */
-               PSPAN_WRITE (EEPROM_REG, cmd);
-
-               /* Wait for data to be valid */
-               while ((val = PSPAN_READ (EEPROM_REG)) & 0x80)
-                       eieio ();
-               /* Do it twice, first read might be erratic */
-               while ((val = PSPAN_READ (EEPROM_REG)) & 0x80)
-                       eieio ();
-
-               /* Read error */
-               if (val & 0x00000040) {
-                       return -1;
-               } else {
-                       data[i] = (val >> 16) & 0xff;
-               }
-       }
-       return 0;
-}
-
-/***************************************************************
- * We take some basic Hardware Configuration Parameter from the
- * Serial EEPROM conected to the PSpan bridge. We keep it as
- * simple as possible.
- */
-#ifdef DEBUG
-static int hwc_flash_size (void)
-{
-       uchar byte;
-
-       if (!seeprom_read (0x40, &byte, sizeof (byte))) {
-               switch ((byte >> 2) & 0x3) {
-               case 0x1:
-                       return 0x0400000;
-                       break;
-               case 0x2:
-                       return 0x0800000;
-                       break;
-               case 0x3:
-                       return 0x1000000;
-               default:
-                       return 0x0100000;
-               }
-       }
-       return -1;
-}
-
-static int hwc_local_sdram_size (void)
-{
-       uchar byte;
-
-       if (!seeprom_read (0x40, &byte, sizeof (byte))) {
-               switch ((byte & 0x03)) {
-               case 0x1:
-                       return 0x0800000;
-               case 0x2:
-                       return 0x1000000;
-               default:
-                       return 0;                       /* not present */
-               }
-       }
-       return -1;
-}
-#endif /* DEBUG */
-
-static int hwc_main_sdram_size (void)
-{
-       uchar byte;
-
-       if (!seeprom_read (0x41, &byte, sizeof (byte))) {
-               return 0x1000000 << ((byte >> 5) & 0x7);
-       }
-       return -1;
-}
-
-static int hwc_serial_number (void)
-{
-       int sn = -1;
-
-       if (!seeprom_read (0xa0, (uchar *) &sn, sizeof (sn))) {
-               sn = cpu_to_le32 (sn);
-       }
-       return sn;
-}
-
-static int hwc_mac_address (char *str)
-{
-       char mac[6];
-
-       if (!seeprom_read (0xb0, (uchar *)mac, sizeof (mac))) {
-               sprintf (str, "%02X:%02X:%02X:%02X:%02X:%02X",
-                                mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
-       } else {
-               strcpy (str, "ERROR");
-               return -1;
-       }
-       return 0;
-}
-
-static int hwc_manufact_date (char *str)
-{
-       uchar byte;
-       int value;
-
-       if (seeprom_read (0x92, &byte, sizeof (byte)))
-               goto out;
-       value = byte;
-       if (seeprom_read (0x93, &byte, sizeof (byte)))
-               goto out;
-       value += byte << 8;
-       sprintf (str, "%02d/%02d/%04d",
-                        value & 0x1F, (value >> 5) & 0xF,
-                        1980 + ((value >> 9) & 0x1FF));
-       return 0;
-
-out:
-       strcpy (str, "ERROR");
-       return -1;
-}
-
-static int hwc_board_type (char **str)
-{
-       ushort id = 0;
-
-       if (seeprom_read (7, (uchar *) & id, sizeof (id)) == 0) {
-               switch (id) {
-               case 0x9080:
-                       *str = "4532-002";
-                       break;
-               case 0x9081:
-                       *str = "4532-001";
-                       break;
-               case 0x9082:
-                       *str = "4532-000";
-                       break;
-               default:
-                       *str = "Unknown";
-               }
-       } else {
-               *str = "Unknown";
-       }
-
-       return id;
-}
-
-phys_size_t initdram (int board_type)
-{
-       long maxsize = hwc_main_sdram_size();
-
-#if !defined(CONFIG_SYS_RAMBOOT) && !defined(CONFIG_SYS_USE_FIRMWARE)
-       volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
-       volatile memctl8260_t *memctl = &immap->im_memctl;
-       volatile uchar *base;
-       int i;
-
-       immap->im_siu_conf.sc_ppc_acr  = 0x00000026;
-       immap->im_siu_conf.sc_ppc_alrh = 0x01276345;
-       immap->im_siu_conf.sc_ppc_alrl = 0x89ABCDEF;
-       immap->im_siu_conf.sc_lcl_acr  = 0x00000000;
-       immap->im_siu_conf.sc_lcl_alrh = 0x01234567;
-       immap->im_siu_conf.sc_lcl_alrl = 0x89ABCDEF;
-       immap->im_siu_conf.sc_tescr1   = 0x00004000;
-       immap->im_siu_conf.sc_ltescr1  = 0x00004000;
-
-       memctl->memc_mptpr = CONFIG_SYS_MPTPR;
-
-       /* Initialise 60x bus SDRAM */
-       base = (uchar *)(CONFIG_SYS_SDRAM_BASE | 0x110);
-       memctl->memc_psrt  = CONFIG_SYS_PSRT;
-       memctl->memc_or1   = CONFIG_SYS_60x_OR;
-       memctl->memc_br1   = CONFIG_SYS_SDRAM_BASE | CONFIG_SYS_60x_BR;
-
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | 0x28000000;
-       *base = 0xFF;
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | 0x08000000;
-       for (i = 0; i < 8; i++)
-               *base = 0xFF;
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | 0x18000000;
-       *base = 0xFF;
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | 0x40000000;
-
-       /* Initialise local bus SDRAM */
-       base = (uchar *)CONFIG_SYS_LSDRAM_BASE;
-       memctl->memc_lsrt  = CONFIG_SYS_LSRT;
-       memctl->memc_or2   = CONFIG_SYS_LOC_OR;
-       memctl->memc_br2   = CONFIG_SYS_LSDRAM_BASE | CONFIG_SYS_LOC_BR;
-
-       memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x28000000;
-       *base = 0xFF;
-       memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x08000000;
-       for (i = 0; i < 8; i++)
-               *base = 0xFF;
-       memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x18000000;
-       *base = 0xFF;
-       memctl->memc_lsdmr = CONFIG_SYS_LSDMR | 0x40000000;
-
-       /* We must be able to test a location outsize the maximum legal size
-        * to find out THAT we are outside; but this address still has to be
-        * mapped by the controller. That means, that the initial mapping has
-        * to be (at least) twice as large as the maximum expected size.
-        */
-       maxsize = (~(memctl->memc_or1 & BRx_BA_MSK) + 1) / 2;
-
-       maxsize = get_ram_size((long *)(memctl->memc_br1 & BRx_BA_MSK), maxsize);
-
-       memctl->memc_or1 |= ~(maxsize - 1);
-
-       if (maxsize != hwc_main_sdram_size())
-               puts("Oops: memory test has not found all memory!\n");
-#endif /* !CONFIG_SYS_RAMBOOT && !CONFIG_SYS_USE_FIRMWARE */
-
-       /* Return total RAM size (size of 60x SDRAM) */
-       return maxsize;
-}
-
-int checkboard(void)
-{
-       char string[32], *id;
-
-       hwc_manufact_date(string);
-       hwc_board_type(&id);
-       printf("Board: Interphase iSPAN %s (#%d %s)\n",
-              id, hwc_serial_number(), string);
-#ifdef DEBUG
-       printf("Manufacturing date: %s\n", string);
-       printf("Serial number     : %d\n", hwc_serial_number());
-       printf("FLASH size        : %d MB\n", hwc_flash_size() >> 20);
-       printf("Main SDRAM size   : %d MB\n", hwc_main_sdram_size() >> 20);
-       printf("Local SDRAM size  : %d MB\n", hwc_local_sdram_size() >> 20);
-       hwc_mac_address(string);
-       printf("MAC address       : %s\n", string);
-#endif
-       return 0;
-}
-
-int misc_init_r(void)
-{
-       char *s, str[32];
-       int num;
-
-       if ((s = getenv("serial#")) == NULL &&
-           (num = hwc_serial_number()) != -1) {
-               sprintf(str, "%06d", num);
-               setenv("serial#", str);
-       }
-       if ((s = getenv("ethaddr")) == NULL && hwc_mac_address(str) == 0) {
-               setenv("ethaddr", str);
-       }
-
-       return 0;
-}
index f941e44e833b860933085e67194ac7f57d572548..2ddb3da38f35f7245551bd66ebbffabd71f59420 100644 (file)
@@ -12,7 +12,7 @@
 #include <ioports.h>
 #include <command.h>
 #include <malloc.h>
-#include <hush.h>
+#include <cli_hush.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
index f0e91bbdfe4f310aae832f1924f2a7094e20fc95..bffc08be951e0a7c4cdec47f47c8cc48558c0852 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #include <common.h>
-#include <hush.h>
+#include <cli_hush.h>
 #include <i2c.h>
 #include "common.h"
 
index 2f622b0846e103f5b3036322269e5577ca451427..43173ce060d56817353595d681bbf531cba1c76a 100644 (file)
 #include <usb.h>
 #include <part.h>
 
-#ifdef CONFIG_SYS_HUSH_PARSER
-#include <hush.h>
-#endif
-
-
 #ifdef CONFIG_AUTO_UPDATE
 
 #ifndef CONFIG_USB_OHCI
@@ -247,7 +242,7 @@ int au_do_update(int idx, long sz)
                /* parse_string_outer() runs off the end. */
                addr[image_get_data_size (hdr)] = 0;
                addr += 8;
-               parse_string_outer(addr, FLAG_PARSE_SEMICOLON);
+               run_command_list(addr, -1, 0);
                return 0;
        }
 
diff --git a/board/quad100hd/Makefile b/board/quad100hd/Makefile
deleted file mode 100644 (file)
index b65e5ad..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2007
-# Stefan Roese, DENX Software Engineering, sr@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  = quad100hd.o nand.o
diff --git a/board/quad100hd/nand.c b/board/quad100hd/nand.c
deleted file mode 100644 (file)
index 47bbb6b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * (C) Copyright 2008
- * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <config.h>
-#if defined(CONFIG_CMD_NAND)
-#include <asm/ppc4xx-gpio.h>
-#include <asm/io.h>
-#include <nand.h>
-
-/*
- *     hardware specific access to control-lines
- */
-static void quad100hd_hwcontrol(struct mtd_info *mtd,
-                               int cmd, unsigned int ctrl)
-{
-       struct nand_chip *this = mtd->priv;
-
-       if (ctrl & NAND_CTRL_CHANGE) {
-               gpio_write_bit(CONFIG_SYS_NAND_CLE, !!(ctrl & NAND_CLE));
-               gpio_write_bit(CONFIG_SYS_NAND_ALE, !!(ctrl & NAND_ALE));
-               gpio_write_bit(CONFIG_SYS_NAND_CE, !(ctrl & NAND_NCE));
-       }
-
-       if (cmd != NAND_CMD_NONE)
-               writeb(cmd, this->IO_ADDR_W);
-}
-
-static int quad100hd_nand_ready(struct mtd_info *mtd)
-{
-       return gpio_read_in_bit(CONFIG_SYS_NAND_RDY);
-}
-
-/*
- * Main initialization routine
- */
-int board_nand_init(struct nand_chip *nand)
-{
-       /* Set address of hardware control function */
-       nand->cmd_ctrl = quad100hd_hwcontrol;
-       nand->dev_ready = quad100hd_nand_ready;
-       nand->ecc.mode = NAND_ECC_SOFT;
-       /* 15 us command delay time */
-       nand->chip_delay =  20;
-
-       /* Return happy */
-       return 0;
-}
-#endif /* CONFIG_CMD_NAND */
diff --git a/board/quad100hd/quad100hd.c b/board/quad100hd/quad100hd.c
deleted file mode 100644 (file)
index bb14ca7..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * (C) Copyright 2008
- * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de.
- *
- * Based in part on board/icecube/icecube.c from PPCBoot
- * (C) Copyright 2003 Intrinsyc Software
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <command.h>
-#include <malloc.h>
-#include <environment.h>
-#include <logbuff.h>
-#include <post.h>
-
-#include <asm/processor.h>
-#include <asm/io.h>
-#include <asm/ppc4xx-gpio.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-int board_early_init_f(void)
-{
-       /* taken from PPCBoot */
-       mtdcr(UIC0SR, 0xFFFFFFFF);      /* clear all ints */
-       mtdcr(UIC0ER, 0x00000000);      /* disable all ints */
-       mtdcr(UIC0CR, 0x00000000);
-       mtdcr(UIC0PR, 0xFFFF7FFE);      /* set int polarities */
-       mtdcr(UIC0TR, 0x00000000);      /* set int trigger levels */
-       mtdcr(UIC0SR, 0xFFFFFFFF);      /* clear all ints */
-       mtdcr(UIC0VCR, 0x00000001);     /* set vect base=0,INT0 highest priority */
-
-       mtdcr(CPC0_SRR, 0x00040000);   /* Hold PCI bridge in reset */
-
-       return 0;
-}
-
-/*
- * Check Board Identity:
- */
-int checkboard(void)
-{
-       char buf[64];
-       int i = getenv_f("serial#", buf, sizeof(buf));
-#ifdef DISPLAY_BOARD_INFO
-       sys_info_t sysinfo;
-#endif
-
-       puts("Board: Quad100hd");
-
-       if (i > 0) {
-               puts(", serial# ");
-               puts(buf);
-       }
-       putc('\n');
-
-#ifdef DISPLAY_BOARD_INFO
-       /* taken from ppcboot */
-       get_sys_info(&sysinfo);
-
-       printf("\tVCO: %lu MHz\n", sysinfo.freqVCOMhz);
-       printf("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
-       printf("\tPLB: %lu MHz\n", sysinfo.freqPLB / 1000000);
-       printf("\tOPB: %lu MHz\n", sysinfo.freqOPB / 1000000);
-       printf("\tEPB: %lu MHz\n", sysinfo.freqPLB / (sysinfo.pllExtBusDiv *
-               1000000));
-       printf("\tPCI: %lu MHz\n", sysinfo.freqPCI / 1000000);
-#endif
-
-       return 0;
-}
diff --git a/board/rattler/Makefile b/board/rattler/Makefile
deleted file mode 100644 (file)
index 9de89c8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2001-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  := rattler.o
diff --git a/board/rattler/rattler.c b/board/rattler/rattler.c
deleted file mode 100644 (file)
index f7fb349..0000000
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (C) 2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * Support for Analogue&Micro Rattler boards family.
- * Tested on Rattler8248.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <mpc8260.h>
-#include <ioports.h>
-
-/*
- * I/O Port configuration table
- *
- * if conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-#define CONFIG_SYS_FCC1 (CONFIG_ETHER_INDEX == 1)
-#define CONFIG_SYS_FCC2 (CONFIG_ETHER_INDEX == 2)
-
-const iop_conf_t iop_conf_tab[4][32] = {
-
-    /* Port A */
-    {  /*            conf      ppar psor pdir podr pdat */
-       /* PA31 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII COL    */
-       /* PA30 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII CRS    */
-       /* PA29 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_ER  */
-       /* PA28 */ { CONFIG_SYS_FCC1,   1,   1,   1,   0,   0 }, /* FCC1 MII TX_EN  */
-       /* PA27 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_DV  */
-       /* PA26 */ { CONFIG_SYS_FCC1,   1,   1,   0,   0,   0 }, /* FCC1 MII RX_ER  */
-       /* PA25 */ { 0,          0,   0,   0,   0,   0 }, /* PA25            */
-       /* PA24 */ { 0,          0,   0,   0,   0,   0 }, /* PA24            */
-       /* PA23 */ { 0,          0,   0,   0,   0,   0 }, /* PA23            */
-       /* PA22 */ { 1,          0,   0,   1,   0,   1 }, /* Eth PHYs reset  */
-       /* PA21 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[3] */
-       /* PA20 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[2] */
-       /* PA19 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[1] */
-       /* PA18 */ { CONFIG_SYS_FCC1,   1,   0,   1,   0,   0 }, /* FCC1 MII TxD[0] */
-       /* PA17 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[0] */
-       /* PA16 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[1] */
-       /* PA15 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[2] */
-       /* PA14 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 MII RxD[3] */
-       /* PA13 */ { 0,          0,   0,   0,   0,   0 }, /* PA13            */
-       /* PA12 */ { 0,          0,   0,   0,   0,   0 }, /* PA12            */
-       /* PA11 */ { 0,          0,   0,   0,   0,   0 }, /* PA11            */
-       /* PA10 */ { 0,          0,   0,   0,   0,   0 }, /* PA10            */
-       /* PA9  */ { 0,          1,   0,   1,   0,   0 }, /* SMC2 TxD        */
-       /* PA8  */ { 0,          1,   0,   0,   0,   0 }, /* SMC2 RxD        */
-       /* PA7  */ { 0,          0,   0,   0,   0,   0 }, /* PA7             */
-       /* PA6  */ { 0,          0,   0,   0,   0,   0 }, /* PA6             */
-       /* PA5  */ { 0,          0,   0,   0,   0,   0 }, /* PA5             */
-       /* PA4  */ { 0,          0,   0,   0,   0,   0 }, /* PA4             */
-       /* PA3  */ { 0,          0,   0,   0,   0,   0 }, /* PA3             */
-       /* PA2  */ { 0,          0,   0,   0,   0,   0 }, /* PA2             */
-       /* PA1  */ { 0,          0,   0,   0,   0,   0 }, /* PA1             */
-       /* PA0  */ { 0,          0,   0,   0,   0,   0 }  /* PA0             */
-    },
-
-    /* Port B */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PB31 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TX_ER  */
-       /* PB30 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_DV  */
-       /* PB29 */ { CONFIG_SYS_FCC2,   1,   1,   1,   0,   0 }, /* FCC2 MII TX_EN  */
-       /* PB28 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RX_ER  */
-       /* PB27 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII COL    */
-       /* PB26 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII CRS    */
-       /* PB25 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[3] */
-       /* PB24 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[2] */
-       /* PB23 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[1] */
-       /* PB22 */ { CONFIG_SYS_FCC2,   1,   0,   1,   0,   0 }, /* FCC2 MII TxD[0] */
-       /* PB21 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[0] */
-       /* PB20 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[1] */
-       /* PB19 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[2] */
-       /* PB18 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 MII RxD[3] */
-       /* PB17 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB16 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB15 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB14 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB13 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB12 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB11 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB10 */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB9  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB8  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB7  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB6  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB5  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB4  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB3  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB2  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB1  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PB0  */ { 0,          0,   0,   0,   0,   0 }  /* non-existent    */
-    },
-
-    /* Port C */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PC31 */ { 0,          0,   0,   0,   0,   0 }, /* PC31            */
-       /* PC30 */ { 0,          0,   0,   0,   0,   0 }, /* PC30            */
-       /* PC29 */ { 0,          0,   0,   0,   0,   0 }, /* PC29            */
-       /* PC28 */ { 0,          0,   0,   0,   0,   0 }, /* PC28            */
-       /* PC27 */ { 0,          0,   0,   0,   0,   0 }, /* PC27            */
-       /* PC26 */ { 0,          0,   0,   0,   0,   0 }, /* PC26            */
-       /* PC25 */ { 0,          0,   0,   0,   0,   0 }, /* PC25            */
-       /* PC24 */ { 0,          0,   0,   0,   0,   0 }, /* PC24            */
-       /* PC23 */ { 0,          0,   0,   0,   0,   0 }, /* PC23            */
-       /* PC22 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 TxClk (CLK10) */
-       /* PC21 */ { CONFIG_SYS_FCC1,   1,   0,   0,   0,   0 }, /* FCC1 RxClk (CLK11) */
-       /* PC20 */ { 0,          0,   0,   0,   0,   0 }, /* PC20            */
-       /* PC19 */ { 0,          0,   0,   0,   0,   0 }, /* PC19            */
-       /* PC18 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 TxClk (CLK14) */
-       /* PC17 */ { CONFIG_SYS_FCC2,   1,   0,   0,   0,   0 }, /* FCC2 RxClk (CLK15) */
-       /* PC16 */ { 0,          0,   0,   0,   0,   0 }, /* PC16            */
-       /* PC15 */ { 0,          0,   0,   0,   0,   0 }, /* PC15            */
-       /* PC14 */ { 0,          0,   0,   0,   0,   0 }, /* PC14            */
-       /* PC13 */ { 0,          0,   0,   0,   0,   0 }, /* PC13            */
-       /* PC12 */ { 0,          0,   0,   0,   0,   0 }, /* PC12            */
-       /* PC11 */ { 0,          0,   0,   0,   0,   0 }, /* PC11            */
-       /* PC10 */ { 0,          0,   0,   0,   0,   0 }, /* PC10            */
-       /* PC9  */ { 1,          0,   0,   1,   0,   1 }, /* MDIO            */
-       /* PC8  */ { 1,          0,   0,   1,   0,   1 }, /* MDC             */
-       /* PC7  */ { 0,          0,   0,   0,   0,   0 }, /* PC7             */
-       /* PC6  */ { 0,          0,   0,   0,   0,   0 }, /* PC6             */
-       /* PC5  */ { 1,          1,   0,   1,   0,   0 }, /* SMC1 TxD        */
-       /* PC4  */ { 1,          1,   0,   0,   0,   0 }, /* SMC1 RxD        */
-       /* PC3  */ { 0,          0,   0,   0,   0,   0 }, /* PC3             */
-       /* PC2  */ { 0,          0,   0,   0,   0,   0 }, /* PC2             */
-       /* PC1  */ { 0,          0,   0,   0,   0,   0 }, /* PC1             */
-       /* PC0  */ { 0,          0,   0,   0,   0,   0 }, /* PC0             */
-    },
-
-    /* Port D */
-    {   /*           conf      ppar psor pdir podr pdat */
-       /* PD31 */ { 1,          1,   0,   0,   0,   0 }, /* SCC1 RxD        */
-       /* PD30 */ { 1,          1,   1,   1,   0,   0 }, /* SCC1 TxD        */
-       /* PD29 */ { 0,          0,   0,   0,   0,   0 }, /* PD29            */
-       /* PD28 */ { 0,          0,   0,   0,   0,   0 }, /* PD28            */
-       /* PD27 */ { 0,          0,   0,   0,   0,   0 }, /* PD27            */
-       /* PD26 */ { 0,          0,   0,   0,   0,   0 }, /* PD26            */
-       /* PD25 */ { 0,          0,   0,   0,   0,   0 }, /* PD25            */
-       /* PD24 */ { 0,          0,   0,   0,   0,   0 }, /* PD24            */
-       /* PD23 */ { 0,          0,   0,   0,   0,   0 }, /* PD23            */
-       /* PD22 */ { 0,          0,   0,   0,   0,   0 }, /* PD22            */
-       /* PD21 */ { 0,          0,   0,   0,   0,   0 }, /* PD21            */
-       /* PD20 */ { 0,          0,   0,   0,   0,   0 }, /* PD20            */
-       /* PD19 */ { 0,          0,   0,   0,   0,   0 }, /* PD19            */
-       /* PD18 */ { 0,          0,   0,   0,   0,   0 }, /* PD18            */
-       /* PD17 */ { 0,          0,   0,   0,   0,   0 }, /* PD17            */
-       /* PD16 */ { 0,          0,   0,   0,   0,   0 }, /* PD16            */
-       /* PD15 */ { 0,          0,   0,   0,   0,   0 }, /* PD15            */
-       /* PD14 */ { 0,          0,   0,   0,   0,   0 }, /* PD14            */
-       /* PD13 */ { 0,          0,   0,   0,   0,   0 }, /* PD13            */
-       /* PD12 */ { 0,          0,   0,   0,   0,   0 }, /* PD12            */
-       /* PD11 */ { 0,          0,   0,   0,   0,   0 }, /* PD11            */
-       /* PD10 */ { 0,          0,   0,   0,   0,   0 }, /* PD10            */
-       /* PD9  */ { 0,          0,   0,   0,   0,   0 }, /* PD9             */
-       /* PD8  */ { 0,          0,   0,   0,   0,   0 }, /* PD8             */
-       /* PD7  */ { 0,          0,   0,   0,   0,   0 }, /* PD7             */
-       /* PD6  */ { 0,          0,   0,   0,   0,   0 }, /* PD6             */
-       /* PD5  */ { 0,          0,   0,   0,   0,   0 }, /* PD5             */
-       /* PD4  */ { 0,          0,   0,   0,   0,   0 }, /* PD4             */
-       /* PD3  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PD2  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PD1  */ { 0,          0,   0,   0,   0,   0 }, /* non-existent    */
-       /* PD0  */ { 0,          0,   0,   0,   0,   0 }  /* non-existent    */
-    }
-};
-
-phys_size_t initdram(int board_type)
-{
-       long int msize = CONFIG_SYS_SDRAM_SIZE;
-
-#ifndef CONFIG_SYS_RAMBOOT
-       volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-       volatile memctl8260_t *memctl = &immap->im_memctl;
-       vu_char *ramaddr = (vu_char *)CONFIG_SYS_SDRAM_BASE;
-       uchar c = 0xFF;
-       uint psdmr = CONFIG_SYS_PSDMR;
-       int i;
-
-       immap->im_siu_conf.sc_ppc_acr  = 0x02;
-       immap->im_siu_conf.sc_ppc_alrh = 0x30126745;
-       immap->im_siu_conf.sc_tescr1   = 0x00004000;
-
-       memctl->memc_mptpr = CONFIG_SYS_MPTPR;
-
-       /* Initialise 60x bus SDRAM */
-       memctl->memc_psrt = CONFIG_SYS_PSRT;
-       memctl->memc_or1  = CONFIG_SYS_SDRAM_OR;
-       memctl->memc_br1  = CONFIG_SYS_SDRAM_BR;
-       memctl->memc_psdmr = psdmr | PSDMR_OP_PREA; /* Precharge all banks */
-       *ramaddr = c;
-       memctl->memc_psdmr = psdmr | PSDMR_OP_CBRR; /* CBR refresh */
-       for (i = 0; i < 8; i++)
-               *ramaddr = c;
-       memctl->memc_psdmr = psdmr | PSDMR_OP_MRW;  /* Mode Register write */
-       *ramaddr = c;
-       memctl->memc_psdmr = psdmr | PSDMR_RFEN;    /* Refresh enable */
-       *ramaddr = c;
-#endif /* !CONFIG_SYS_RAMBOOT */
-
-       /* Return total 60x bus SDRAM size */
-       return msize * 1024 * 1024;
-}
-
-int checkboard(void)
-{
-       vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
-
-       printf("Board: Rattler Rev. %c\n", bcsr[0x20] + 0x40);
-       return 0;
-}
diff --git a/board/sunxi/Makefile b/board/sunxi/Makefile
new file mode 100644 (file)
index 0000000..cbf8f08
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net>
+#
+# Based on some other board Makefile
+#
+# (C) Copyright 2000-2003
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+obj-y  += board.o
+obj-$(CONFIG_SUNXI_GMAC)       += gmac.o
+obj-$(CONFIG_CUBIETRUCK)       += dram_cubietruck.o
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
new file mode 100644 (file)
index 0000000..b05d0b9
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net>
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+ *
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Some board init for the Allwinner A10-evb board.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/dram.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/mmc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* add board specific code here */
+int board_init(void)
+{
+       int id_pfr1;
+
+       gd->bd->bi_boot_params = (PHYS_SDRAM_0 + 0x100);
+
+       asm volatile("mrc p15, 0, %0, c0, c1, 1" : "=r"(id_pfr1));
+       debug("id_pfr1: 0x%08x\n", id_pfr1);
+       /* Generic Timer Extension available? */
+       if ((id_pfr1 >> 16) & 0xf) {
+               debug("Setting CNTFRQ\n");
+               /* CNTFRQ == 24 MHz */
+               asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(24000000));
+       }
+
+       return 0;
+}
+
+int dram_init(void)
+{
+       gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE);
+
+       return 0;
+}
+
+#ifdef CONFIG_GENERIC_MMC
+static void mmc_pinmux_setup(int sdc)
+{
+       unsigned int pin;
+
+       switch (sdc) {
+       case 0:
+               /* D1-PF0, D0-PF1, CLK-PF2, CMD-PF3, D3-PF4, D4-PF5 */
+               for (pin = SUNXI_GPF(0); pin <= SUNXI_GPF(5); pin++) {
+                       sunxi_gpio_set_cfgpin(pin, SUNXI_GPF0_SDC0);
+                       sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
+                       sunxi_gpio_set_drv(pin, 2);
+               }
+               break;
+
+       case 1:
+               /* CMD-PH22, CLK-PH23, D0~D3-PH24~27 : 5 */
+               for (pin = SUNXI_GPH(22); pin <= SUNXI_GPH(27); pin++) {
+                       sunxi_gpio_set_cfgpin(pin, SUN4I_GPH22_SDC1);
+                       sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
+                       sunxi_gpio_set_drv(pin, 2);
+               }
+               break;
+
+       case 2:
+               /* CMD-PC6, CLK-PC7, D0-PC8, D1-PC9, D2-PC10, D3-PC11 */
+               for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(11); pin++) {
+                       sunxi_gpio_set_cfgpin(pin, SUNXI_GPC6_SDC2);
+                       sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
+                       sunxi_gpio_set_drv(pin, 2);
+               }
+               break;
+
+       case 3:
+               /* CMD-PI4, CLK-PI5, D0~D3-PI6~9 : 2 */
+               for (pin = SUNXI_GPI(4); pin <= SUNXI_GPI(9); pin++) {
+                       sunxi_gpio_set_cfgpin(pin, SUN4I_GPI4_SDC3);
+                       sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
+                       sunxi_gpio_set_drv(pin, 2);
+               }
+               break;
+
+       default:
+               printf("sunxi: invalid MMC slot %d for pinmux setup\n", sdc);
+               break;
+       }
+}
+
+int board_mmc_init(bd_t *bis)
+{
+       mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
+       sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT);
+#if !defined (CONFIG_SPL_BUILD) && defined (CONFIG_MMC_SUNXI_SLOT_EXTRA)
+       mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
+       sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA);
+#endif
+
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+void sunxi_board_init(void)
+{
+       unsigned long ramsize;
+
+       printf("DRAM:");
+       ramsize = sunxi_dram_init();
+       printf(" %lu MiB\n", ramsize >> 20);
+       if (!ramsize)
+               hang();
+}
+#endif
diff --git a/board/sunxi/dram_cubietruck.c b/board/sunxi/dram_cubietruck.c
new file mode 100644 (file)
index 0000000..fbcd687
--- /dev/null
@@ -0,0 +1,31 @@
+/* this file is generated, don't edit it yourself */
+
+#include <common.h>
+#include <asm/arch/dram.h>
+
+static struct dram_para dram_para = {
+       .clock = 432,
+       .type = 3,
+       .rank_num = 1,
+       .density = 4096,
+       .io_width = 8,
+       .bus_width = 32,
+       .cas = 9,
+       .zq = 0x7f,
+       .odt_en = 0,
+       .size = 2048,
+       .tpr0 = 0x42d899b7,
+       .tpr1 = 0xa090,
+       .tpr2 = 0x22a00,
+       .tpr3 = 0x0,
+       .tpr4 = 0x1,
+       .tpr5 = 0x0,
+       .emr1 = 0x4,
+       .emr2 = 0x10,
+       .emr3 = 0x0,
+};
+
+unsigned long sunxi_dram_init(void)
+{
+       return dramc_init(&dram_para);
+}
diff --git a/board/sunxi/gmac.c b/board/sunxi/gmac.c
new file mode 100644 (file)
index 0000000..e48328d
--- /dev/null
@@ -0,0 +1,32 @@
+#include <common.h>
+#include <netdev.h>
+#include <miiphy.h>
+#include <asm/gpio.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/gpio.h>
+
+int sunxi_gmac_initialize(bd_t *bis)
+{
+       int pin;
+       struct sunxi_ccm_reg *const ccm =
+               (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       /* Set up clock gating */
+       setbits_le32(&ccm->ahb_gate1, 0x1 << AHB_GATE_OFFSET_GMAC);
+
+       /* Set MII clock */
+       setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
+               CCM_GMAC_CTRL_GPIT_RGMII);
+
+       /* Configure pin mux settings for GMAC */
+       for (pin = SUNXI_GPA(0); pin <= SUNXI_GPA(16); pin++) {
+               /* skip unused pins in RGMII mode */
+               if (pin == SUNXI_GPA(9) || pin == SUNXI_GPA(14))
+                       continue;
+               sunxi_gpio_set_cfgpin(pin, SUN7I_GPA0_GMAC);
+               sunxi_gpio_set_drv(pin, 3);
+       }
+
+       return designware_initialize(SUNXI_GMAC_BASE, PHY_INTERFACE_MODE_RGMII);
+}
diff --git a/board/zpc1900/Makefile b/board/zpc1900/Makefile
deleted file mode 100644 (file)
index e636365..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# (C) Copyright 2001-2006
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# SPDX-License-Identifier:     GPL-2.0+
-#
-
-obj-y  := zpc1900.o
diff --git a/board/zpc1900/zpc1900.c b/board/zpc1900/zpc1900.c
deleted file mode 100644 (file)
index fed4934..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * (C) Copyright 2001-2003
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * (C) Copyright 2003-2005 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#include <common.h>
-#include <ioports.h>
-#include <mpc8260.h>
-#include <miiphy.h>
-
-/*
- * I/O Port configuration table
- *
- * if conf is 1, then that port pin will be configured at boot time
- * according to the five values podr/pdir/ppar/psor/pdat for that entry
- */
-
-const iop_conf_t iop_conf_tab[4][32] = {
-
-    /* Port A */
-    {  /*            conf ppar psor pdir podr pdat */
-       /* PA31 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 TxENB  */
-       /* PA30 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 TxClav */
-       /* PA29 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 TxSOC  */
-       /* PA28 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 RxENB  */
-       /* PA27 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 RxSOC  */
-       /* PA26 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 RxClav */
-       /* PA25 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[0] */
-       /* PA24 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[1] */
-       /* PA23 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[2] */
-       /* PA22 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[3] */
-       /* PA21 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[4] */
-       /* PA20 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[5] */
-       /* PA19 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[6] */
-       /* PA18 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXD[7] */
-       /* PA17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[7] */
-       /* PA16 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[6] */
-       /* PA15 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[5] */
-       /* PA14 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[4] */
-       /* PA13 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[3] */
-       /* PA12 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[2] */
-       /* PA11 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[1] */
-       /* PA10 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXD[0] */
-       /* PA9  */ {   0,   1,   1,   1,   0,   0   }, /* SMC2 TXD */
-       /* PA8  */ {   0,   1,   1,   0,   0,   0   }, /* SMC2 RXD */
-       /* PA7  */ {   0,   0,   0,   0,   0,   0   }, /* PA7 */
-       /* PA6  */ {   0,   0,   0,   0,   0,   0   }, /* PA6 */
-       /* PA5  */ {   0,   0,   0,   0,   0,   0   }, /* PA5 */
-       /* PA4  */ {   0,   0,   0,   0,   0,   0   }, /* PA4 */
-       /* PA3  */ {   0,   0,   0,   0,   0,   0   }, /* PA3 */
-       /* PA2  */ {   0,   0,   0,   0,   0,   0   }, /* PA2 */
-       /* PA1  */ {   0,   0,   0,   0,   0,   0   }, /* PA1 */
-       /* PA0  */ {   0,   0,   0,   0,   0,   0   }  /* PA0 */
-    },
-
-    /* Port B */
-    {   /*           conf ppar psor pdir podr pdat */
-       /* PB31 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TX_ER  */
-       /* PB30 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_DV  */
-       /* PB29 */ {   1,   1,   1,   1,   0,   0   }, /* FCC2 MII TX_EN  */
-       /* PB28 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RX_ER  */
-       /* PB27 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII COL    */
-       /* PB26 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII CRS    */
-       /* PB25 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[3] */
-       /* PB24 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[2] */
-       /* PB23 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[1] */
-       /* PB22 */ {   1,   1,   0,   1,   0,   0   }, /* FCC2 MII TxD[0] */
-       /* PB21 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[0] */
-       /* PB20 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[1] */
-       /* PB19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[2] */
-       /* PB18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII RxD[3] */
-       /* PB17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:RX_DIV */
-       /* PB16 */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:RX_ERR */
-       /* PB15 */ {   0,   1,   0,   1,   0,   0   }, /* FCC3:TX_ERR */
-       /* PB14 */ {   0,   1,   0,   1,   0,   0   }, /* FCC3:TX_EN  */
-       /* PB13 */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:COL */
-       /* PB12 */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:CRS */
-       /* PB11 */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB10 */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB9  */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB8  */ {   0,   1,   0,   0,   0,   0   }, /* FCC3:RXD */
-       /* PB7  */ {   0,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB6  */ {   0,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB5  */ {   0,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB4  */ {   0,   1,   0,   1,   0,   0   }, /* FCC3:TXD */
-       /* PB3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PB0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    },
-
-    /* Port C */
-    {   /*           conf ppar psor pdir podr pdat */
-       /* PC31 */ {   0,   0,   0,   0,   0,   0   }, /* PC31 */
-       /* PC30 */ {   0,   0,   0,   0,   0,   0   }, /* PC30 */
-       /* PC29 */ {   0,   1,   1,   0,   0,   0   }, /* SCC1 EN CLSN */
-       /* PC28 */ {   0,   0,   0,   0,   0,   0   }, /* PC28 */
-       /* PC27 */ {   0,   0,   0,   0,   0,   0   }, /* PC27 */
-       /* PC26 */ {   0,   0,   0,   0,   0,   0   }, /* PC26 */
-       /* PC25 */ {   0,   0,   0,   0,   0,   0   }, /* PC25 */
-       /* PC24 */ {   0,   0,   0,   0,   0,   0   }, /* PC24 */
-       /* PC23 */ {   0,   1,   0,   0,   0,   0   }, /* SCC1 EN RXCLK */
-       /* PC22 */ {   0,   1,   0,   0,   0,   0   }, /* SCC1 EN TXCLK */
-       /* PC21 */ {   0,   0,   0,   0,   0,   0   }, /* PC21 */
-       /* PC20 */ {   0,   0,   0,   0,   0,   0   }, /* PC20 */
-       /* PC19 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII Rx Clock (CLK13) */
-       /* PC18 */ {   1,   1,   0,   0,   0,   0   }, /* FCC2 MII Tx Clock (CLK14) */
-       /* PC17 */ {   0,   0,   0,   0,   0,   0   }, /* PC17 */
-       /* PC16 */ {   0,   0,   0,   0,   0,   0   }, /* PC16 */
-       /* PC15 */ {   0,   0,   0,   0,   0,   0   }, /* PC15 */
-       /* PC14 */ {   0,   1,   0,   0,   0,   0   }, /* SCC1 EN RENA */
-       /* PC13 */ {   0,   0,   0,   0,   0,   0   }, /* PC13 */
-       /* PC12 */ {   0,   0,   0,   0,   0,   0   }, /* PC12 */
-       /* PC11 */ {   0,   0,   0,   0,   0,   0   }, /* PC11 */
-       /* PC10 */ {   1,   0,   0,   1,   0,   0   }, /* LXT972 MDC */
-       /* PC9  */ {   1,   0,   0,   0,   0,   0   }, /* LXT972 MDIO */
-       /* PC8  */ {   0,   0,   0,   0,   0,   0   }, /* PC8 */
-       /* PC7  */ {   0,   0,   0,   0,   0,   0   }, /* PC7 */
-       /* PC6  */ {   0,   0,   0,   0,   0,   0   }, /* PC6 */
-       /* PC5  */ {   0,   0,   0,   0,   0,   0   }, /* PC5 */
-       /* PC4  */ {   0,   0,   0,   0,   0,   0   }, /* PC4 */
-       /* PC3  */ {   0,   0,   0,   0,   0,   0   }, /* PC3 */
-       /* PC2  */ {   0,   0,   0,   0,   0,   0   }, /* PC2 */
-       /* PC1  */ {   0,   0,   0,   0,   0,   0   }, /* PC1 */
-       /* PC0  */ {   0,   0,   0,   0,   0,   0   }, /* PC0 */
-    },
-
-    /* Port D */
-    {   /*           conf ppar psor pdir podr pdat */
-       /* PD31 */ {   0,   1,   0,   0,   0,   0   }, /* SCC1 EN RxD  */
-       /* PD30 */ {   0,   1,   1,   1,   0,   0   }, /* SCC1 EN TxD  */
-       /* PD29 */ {   0,   1,   0,   1,   0,   0   }, /* SCC1 EN TENA */
-       /* PD28 */ {   0,   0,   0,   0,   0,   0   }, /* PD28 */
-       /* PD27 */ {   0,   0,   0,   0,   0,   0   }, /* PD27 */
-       /* PD26 */ {   0,   0,   0,   0,   0,   0   }, /* PD26 */
-       /* PD25 */ {   0,   0,   0,   0,   0,   0   }, /* PD25 */
-       /* PD24 */ {   0,   0,   0,   0,   0,   0   }, /* PD24 */
-       /* PD23 */ {   0,   0,   0,   0,   0,   0   }, /* PD23 */
-       /* PD22 */ {   0,   0,   0,   0,   0,   0   }, /* PD22 */
-       /* PD21 */ {   0,   0,   0,   0,   0,   0   }, /* PD21 */
-       /* PD20 */ {   0,   0,   0,   0,   0,   0   }, /* PD20 */
-       /* PD19 */ {   0,   0,   0,   0,   0,   0   }, /* PD19 */
-       /* PD18 */ {   0,   0,   0,   0,   0,   0   }, /* PD18 */
-       /* PD17 */ {   0,   1,   0,   0,   0,   0   }, /* FCC1 ATMRXPRTY */
-       /* PD16 */ {   0,   1,   0,   1,   0,   0   }, /* FCC1 ATMTXPRTY */
-       /* PD15 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SDA */
-       /* PD14 */ {   0,   1,   1,   0,   1,   0   }, /* I2C SCL */
-       /* PD13 */ {   0,   0,   0,   0,   0,   0   }, /* PD13 */
-       /* PD12 */ {   0,   0,   0,   0,   0,   0   }, /* PD12 */
-       /* PD11 */ {   0,   0,   0,   0,   0,   0   }, /* PD11 */
-       /* PD10 */ {   0,   0,   0,   0,   0,   0   }, /* PD10 */
-       /* PD9  */ {   1,   1,   0,   1,   0,   0   }, /* SMC1 TXD */
-       /* PD8  */ {   1,   1,   0,   0,   0,   0   }, /* SMC1 RXD */
-       /* PD7  */ {   0,   0,   0,   0,   0,   0   }, /* PD7 */
-       /* PD6  */ {   0,   0,   0,   0,   0,   0   }, /* PD6 */
-       /* PD5  */ {   0,   0,   0,   0,   0,   0   }, /* PD5 */
-       /* PD4  */ {   0,   0,   0,   0,   0,   0   }, /* PD4 */
-       /* PD3  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD2  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD1  */ {   0,   0,   0,   0,   0,   0   }, /* pin doesn't exist */
-       /* PD0  */ {   0,   0,   0,   0,   0,   0   }  /* pin doesn't exist */
-    }
-};
-
-#ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-void *nvram_read(void *dest, long src, size_t count)
-{
-       return memcpy(dest, (const void *)src, count);
-}
-
-void nvram_write(long dest, const void *src, size_t count)
-{
-       vu_char     *p1 = (vu_char *)(CONFIG_SYS_EEPROM + 0x1555);
-       vu_char     *p2 = (vu_char *)(CONFIG_SYS_EEPROM + 0x0AAA);
-       vu_char     *d = (vu_char *)dest;
-       const uchar *s = (const uchar *)src;
-
-       /* Unprotect the EEPROM */
-       *p1 = 0xAA;
-       *p2 = 0x55;
-       *p1 = 0x80;
-       *p1 = 0xAA;
-       *p2 = 0x55;
-       *p1 = 0x20;
-       udelay(10000);
-
-       /* Write the data to the EEPROM */
-       while (count--) {
-               *d++ = *s++;
-               while (*(d - 1) != *(s - 1))
-                       /* wait */;
-       }
-
-       /* Protect the EEPROM */
-       *p1 = 0xAA;
-       *p2 = 0x55;
-       *p1 = 0xA0;
-       udelay(10000);
-}
-#endif /* CONFIG_SYS_NVRAM_ACCESS_ROUTINE */
-
-phys_size_t initdram(int board_type)
-{
-       vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
-       volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
-       volatile memctl8260_t *memctl = &immap->im_memctl;
-       vu_char *ramaddr;
-       uchar c = 0xFF;
-       long int msize = CONFIG_SYS_SDRAM_SIZE;
-       int i;
-
-       if (bcsr[4] & BCSR_PCI_MODE) { /* PCI mode selected by JP9 */
-               immap->im_clkrst.car_sccr |= SCCR_PCI_MODE;
-               immap->im_siu_conf.sc_siumcr =
-                       (immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11)
-                       | SIUMCR_LBPC01;
-       }
-
-#ifndef CONFIG_SYS_RAMBOOT
-       immap->im_siu_conf.sc_ppc_acr  = 0x03;
-       immap->im_siu_conf.sc_ppc_alrh = 0x30126745;
-       immap->im_siu_conf.sc_tescr1   = 0x00004000;
-
-       memctl->memc_mptpr = CONFIG_SYS_MPTPR;
-
-#ifdef CONFIG_SYS_LSDRAM_BASE
-       /*
-         Initialise local bus SDRAM only if the pins
-         are configured as local bus pins and not as PCI.
-       */
-       if ((immap->im_siu_conf.sc_siumcr & SIUMCR_LBPC11) == SIUMCR_LBPC00) {
-               memctl->memc_lsrt  = CONFIG_SYS_LSRT;
-               memctl->memc_or4   = CONFIG_SYS_LSDRAM_OR;
-               memctl->memc_br4   = CONFIG_SYS_LSDRAM_BR;
-               ramaddr = (vu_char *)CONFIG_SYS_LSDRAM_BASE;
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_OP_PREA;
-               *ramaddr = c;
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_OP_CBRR;
-               for (i = 0; i < 8; i++)
-                       *ramaddr = c;
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_OP_MRW;
-               *ramaddr = c;
-               memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_RFEN;
-       }
-#endif /* CONFIG_SYS_LSDRAM_BASE */
-
-       /* Initialise 60x bus SDRAM */
-       memctl->memc_psrt = CONFIG_SYS_PSRT;
-       memctl->memc_or2  = CONFIG_SYS_PSDRAM_OR;
-       memctl->memc_br2  = CONFIG_SYS_PSDRAM_BR;
-       /*
-        * The mode data for Mode Register Write command must appear on
-        * the address lines during a mode-set cycle. It is driven by
-        * the memory controller, in single PowerQUICC II mode,
-        * according to PSDMR[CL] and PSDMR[BL] fields. In
-        * 60x-compatible mode, software must drive the correct value on
-        * the address lines. BL=0 because for 64-bit port size burst
-        * length must be 4.
-        */
-       ramaddr = (vu_char *)(CONFIG_SYS_SDRAM_BASE |
-                             ((CONFIG_SYS_PSDMR & PSDMR_CL_MSK) << 7) | 0x10);
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_OP_PREA; /* Precharge all banks */
-       *ramaddr = c;
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_OP_CBRR; /* CBR refresh */
-       for (i = 0; i < 8; i++)
-               *ramaddr = c;
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_OP_MRW;  /* Mode Register write */
-       *ramaddr = c;
-       memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_RFEN;    /* Refresh enable */
-       *ramaddr = c;
-#endif /* CONFIG_SYS_RAMBOOT */
-
-       /* Return total 60x bus SDRAM size */
-       return msize * 1024 * 1024;
-}
-
-int checkboard(void)
-{
-       vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
-
-       printf("Board: Zephyr ZPC.1900 Rev. %c\n", bcsr[2] + 0x40);
-       return 0;
-}
index 221b7f842738e052c9a66d57646c274c46814061..b8cfeade590094a8ab77ef358215931341d77c64 100644 (file)
@@ -47,6 +47,7 @@ Active  aarch64     armv8          -           armltd          vexpress64
 Active  arc         arc700         -           synopsys        -                   axs101                                -                                                                                                                                 Alexey Brodkin <abrodkin@synopsys.com>
 Active  arc         arc700         -           synopsys        <none>              arcangel4                             -                                                                                                                                 Alexey Brodkin <abrodkin@synopsys.com>
 Active  arc         arc700         -           synopsys        <none>              arcangel4-be                          -                                                                                                                                 Alexey Brodkin <abrodkin@synopsys.com>
+Active  arc         arc700         -           abilis          -                   tb100                                 -                                                                                                                                 Alexey Brodkin <abrodkin@synopsys.com>
 Active  arm         arm1136        -           armltd          integrator          integratorcp_cm1136                   integratorcp:CM1136                                                                                                               Linus Walleij <linus.walleij@linaro.org>
 Active  arm         arm1136        mx31        -               -                   imx31_phycore                         -                                                                                                                                 -
 Active  arm         arm1136        mx31        davedenx        -                   qong                                  -                                                                                                                                 Wolfgang Denk <wd@denx.de>
@@ -102,6 +103,7 @@ Active  arm         arm926ejs      at91        atmel           at91sam9263ek
 Active  arm         arm926ejs      at91        atmel           at91sam9263ek       at91sam9263ek_norflash                at91sam9263ek:AT91SAM9263,SYS_USE_NORFLASH                                                                                        Stelian Pop <stelian@popies.net>
 Active  arm         arm926ejs      at91        atmel           at91sam9263ek       at91sam9263ek_norflash_boot           at91sam9263ek:AT91SAM9263,SYS_USE_BOOT_NORFLASH                                                                                   Stelian Pop <stelian@popies.net>
 Active  arm         arm926ejs      at91        atmel           at91sam9m10g45ek    at91sam9m10g45ek_nandflash            at91sam9m10g45ek:AT91SAM9M10G45,SYS_USE_NANDFLASH                                                                                 Bo Shen<voice.shen@atmel.com>
+Active  arm         arm926ejs      at91        atmel           at91sam9m10g45ek    at91sam9m10g45ek_mmc                  at91sam9m10g45ek:AT91SAM9M10G45,SYS_USE_MMC                                                                                       Bo Shen<voice.shen@atmel.com>
 Active  arm         arm926ejs      at91        atmel           at91sam9n12ek       at91sam9n12ek_mmc                     at91sam9n12ek:AT91SAM9N12,SYS_USE_MMC                                                                                             Josh Wu <josh.wu@atmel.com>
 Active  arm         arm926ejs      at91        atmel           at91sam9n12ek       at91sam9n12ek_nandflash               at91sam9n12ek:AT91SAM9N12,SYS_USE_NANDFLASH                                                                                       Josh Wu <josh.wu@atmel.com>
 Active  arm         arm926ejs      at91        atmel           at91sam9n12ek       at91sam9n12ek_spiflash                at91sam9n12ek:AT91SAM9N12,SYS_USE_SPIFLASH                                                                                        Josh Wu <josh.wu@atmel.com>
@@ -295,7 +297,7 @@ Active  arm         armv7          exynos      samsung         smdkv310
 Active  arm         armv7          exynos      samsung         trats               trats                                 -                                                                                                                                 Lukasz Majewski <l.majewski@samsung.com>
 Active  arm         armv7          exynos      samsung         trats2              trats2                                -                                                                                                                                 Piotr Wilczek <p.wilczek@samsung.com>
 Active  arm         armv7          exynos      samsung         universal_c210      s5pc210_universal                     -                                                                                                                                 Przemyslaw Marczak <p.marczak@samsung.com>
-Active  arm         armv7          highbank    -               highbank            highbank                              -                                                                                                                                 Rob Herring <rob.herring@calxeda.com>
+Active  arm         armv7          highbank    -               highbank            highbank                              -                                                                                                                                 Rob Herring <robh@kernel.org>
 Active  arm         armv7          keystone    ti              k2hk_evm            k2hk_evm                              -                                                                                                                                 Vitaly Andrianov <vitalya@ti.com>
 Active  arm         armv7          mx5         denx            m53evk              m53evk                                m53evk:IMX_CONFIG=board/denx/m53evk/imximage.cfg                                                                                  Marek Vasut <marek.vasut@gmail.com>
 Active  arm         armv7          mx5         esg             ima3-mx53           ima3-mx53                             ima3-mx53:IMX_CONFIG=board/esg/ima3-mx53/imximage.cfg                                                                             -
@@ -379,6 +381,8 @@ Active  arm         armv7          rmobile     renesas         lager
 Active  arm         armv7          s5pc1xx     samsung         goni                s5p_goni                              -                                                                                                                                 Przemyslaw Marczak <p.marczak@samsung.com>
 Active  arm         armv7          s5pc1xx     samsung         smdkc100            smdkc100                              -                                                                                                                                 Minkyu Kang <mk7.kang@samsung.com>
 Active  arm         armv7          socfpga     altera          socfpga             socfpga_cyclone5                      -                                                                                                                                 -
+Active  arm         armv7          sunxi       -               sunxi               Cubietruck                            sun7i:CUBIETRUCK,SPL,SUNXI_GMAC,RGMII                                                                                             -
+Active  arm         armv7          sunxi       -               sunxi               Cubietruck_FEL                        sun7i:CUBIETRUCK,SPL_FEL,SUNXI_GMAC,RGMII                                                                                         -
 Active  arm         armv7          u8500       st-ericsson     snowball            snowball                              -                                                                                                                                 Mathieu Poirier <mathieu.poirier@linaro.org>
 Active  arm         armv7          u8500       st-ericsson     u8500               u8500_href                            -                                                                                                                                 -
 Active  arm         armv7          vf610       freescale       vf610twr            vf610twr                              vf610twr:IMX_CONFIG=board/freescale/vf610twr/imximage.cfg                                                                         Alison Wang <b18965@freescale.com>
@@ -1095,7 +1099,6 @@ Active  powerpc     ppc4xx         -           -               -
 Active  powerpc     ppc4xx         -           -               -                   korat                                 -                                                                                                                                 Larry Johnson <lrj@acm.org>
 Active  powerpc     ppc4xx         -           -               -                   lwmon5                                -                                                                                                                                 Stefan Roese <sr@denx.de>
 Active  powerpc     ppc4xx         -           -               -                   pcs440ep                              -                                                                                                                                 Stefan Roese <sr@denx.de>
-Active  powerpc     ppc4xx         -           -               -                   quad100hd                             -                                                                                                                                 Gary Jennejohn <garyj@denx.de>
 Active  powerpc     ppc4xx         -           -               -                   sbc405                                -                                                                                                                                 -
 Active  powerpc     ppc4xx         -           -               -                   sc3                                   -                                                                                                                                 Heiko Schocher <hs@denx.de>
 Active  powerpc     ppc4xx         -           -               -                   t3corp                                -                                                                                                                                 Stefan Roese <sr@denx.de>
@@ -1236,37 +1239,10 @@ Orphan  blackfin    blackfin       -           -               -
 Orphan  blackfin    blackfin       -           -               -                   tcm-bf537                             -                                                                                                                                 Bluetechnix Tinyboards <bluetechnix@blackfin.uclinux.org>
 Orphan  powerpc     mpc5xxx        -           matrix_vision   mvbc_p              MVBC_P                                MVBC_P:MVBC_P                                                                                                                     Andre Schwarz <andre.schwarz@matrix-vision.de>
 Orphan  powerpc     mpc5xxx        -           matrix_vision   mvsmr               MVSMR                                 -                                                                                                                                 Andre Schwarz <andre.schwarz@matrix-vision.de>
-Orphan  powerpc     mpc824x        -           -               hidden_dragon       HIDDEN_DRAGON                         -                                                                                                                                 Yusdi Santoso <yusdi_santoso@adaptec.com>
-Orphan  powerpc     mpc824x        -           etin            -                   debris                                -                                                                                                                                 Sangmoon Kim <dogoil@etinsys.com>
-Orphan  powerpc     mpc824x        -           etin            -                   kvme080                               -                                                                                                                                 Sangmoon Kim <dogoil@etinsys.com>
-Orphan  powerpc     mpc8260        -           -               ep8248              ep8248                                -                                                                                                                                 Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           -               ispan               ISPAN                                 -                                                                                                                                 Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           -               ispan               ISPAN_REVB                            ISPAN:SYS_REV_B                                                                                                                   Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           -               rattler             Rattler                               -                                                                                                                                 Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           -               rattler             Rattler8248                           Rattler:MPC8248                                                                                                                   Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           -               zpc1900             ZPC1900                               -                                                                                                                                 Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8260ADS                            MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS                                                                                             Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8260ADS_33MHz                      MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=33000000                                                                         Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8260ADS_33MHz_lowboot              MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=33000000,SYS_TEXT_BASE=0xFF800000                                                Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8260ADS_40MHz                      MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=40000000                                                                         Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8260ADS_40MHz_lowboot              MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,8260_CLKIN=40000000,SYS_TEXT_BASE=0xFF800000                                                Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8260ADS_lowboot                    MPC8260ADS:ADSTYPE=CONFIG_SYS_8260ADS,SYS_TEXT_BASE=0xFF800000                                                                    Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8272ADS                            MPC8260ADS:ADSTYPE=CONFIG_SYS_8272ADS                                                                                             Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          MPC8272ADS_lowboot                    MPC8260ADS:ADSTYPE=CONFIG_SYS_8272ADS,SYS_TEXT_BASE=0xFF800000                                                                    Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS                               MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS                                                                                             Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS-VR                            MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000                                                                         Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS-VR_lowboot                    MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000,SYS_TEXT_BASE=0xFF800000                                                Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS-ZU                            MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS                                                                                             Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS-ZU_66MHz                      MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000                                                                         Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS-ZU_66MHz_lowboot              MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000,SYS_TEXT_BASE=0xFF800000                                                Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS-ZU_lowboot                    MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000                                                                    Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8260        -           freescale       mpc8260ads          PQ2FADS_lowboot                       MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000                                                                    Yuli Barcohen <yuli@arabellasw.com>
 Orphan  powerpc     mpc83xx        -           freescale       mpc8360erdk         MPC8360ERDK                           -                                                                                                                                 Anton Vorontsov <avorontsov@ru.mvista.com>
 Orphan  powerpc     mpc83xx        -           freescale       mpc8360erdk         MPC8360ERDK_33                        MPC8360ERDK:CLKIN_33MHZ                                                                                                           Anton Vorontsov <avorontsov@ru.mvista.com>
 Orphan  powerpc     mpc83xx        -           matrix_vision   mergerbox           MERGERBOX                             -                                                                                                                                 Andre Schwarz <andre.schwarz@matrix-vision.de>
 Orphan  powerpc     mpc83xx        -           matrix_vision   mvblm7              MVBLM7                                -                                                                                                                                 Andre Schwarz <andre.schwarz@matrix-vision.de>
-Orphan  powerpc     mpc8xx         -           -               adder               Adder                                 -                                                                                                                                 Yuli Barcohen <yuli@arabellasw.com>
-Orphan  powerpc     mpc8xx         -           -               adder               AdderII                               Adder:MPC852T                                                                                                                     Yuli Barcohen <yuli@arabellasw.com>
 Orphan  powerpc     ppc4xx         -           amcc            -                   bluestone                             -                                                                                                                                 Tirumala Marri <tmarri@apm.com>
 Orphan  powerpc     ppc4xx         -           cray            L1                  CRAYL1                                -                                                                                                                                 David Updegraff <dave@cray.com>
 Orphan  powerpc     ppc4xx         -           sandburst       karef               KAREF                                 -                                                                                                                                 Travis Sawyer <travis.sawyer@sandburst.com>
index 219cb51b2d70c956b11a6666687dfe019d948490..391a8d6230a3ebb68cdeb3259971055377dac745 100644 (file)
@@ -11,11 +11,29 @@ obj-y += main.o
 obj-y += command.o
 obj-y += exports.o
 obj-y += hash.o
-obj-$(CONFIG_SYS_HUSH_PARSER) += hush.o
+ifdef CONFIG_SYS_HUSH_PARSER
+obj-y += cli_hush.o
+endif
+
+# We always have this since drivers/ddr/fs/interactive.c needs it
+obj-y += cli_simple.o
+
+obj-y += cli.o
+obj-y += cli_readline.o
 obj-y += s_record.o
 obj-y += xyzModem.o
 obj-y += cmd_disk.o
 
+# This option is not just y/n - it can have a numeric value
+ifdef CONFIG_BOOTDELAY
+obj-y += autoboot.o
+endif
+
+# This option is not just y/n - it can have a numeric value
+ifdef CONFIG_BOOT_RETRY_TIME
+obj-y += bootretry.o
+endif
+
 # boards
 obj-$(CONFIG_SYS_GENERIC_BOARD) += board_f.o
 obj-$(CONFIG_SYS_GENERIC_BOARD) += board_r.o
diff --git a/common/autoboot.c b/common/autoboot.c
new file mode 100644 (file)
index 0000000..dc24cae
--- /dev/null
@@ -0,0 +1,303 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <bootretry.h>
+#include <cli.h>
+#include <fdtdec.h>
+#include <menu.h>
+#include <post.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define MAX_DELAY_STOP_STR 32
+
+#ifndef DEBUG_BOOTKEYS
+#define DEBUG_BOOTKEYS 0
+#endif
+#define debug_bootkeys(fmt, args...)           \
+       debug_cond(DEBUG_BOOTKEYS, fmt, ##args)
+
+/* Stored value of bootdelay, used by autoboot_command() */
+static int stored_bootdelay;
+
+/***************************************************************************
+ * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
+ * returns: 0 -  no key string, allow autoboot 1 - got key string, abort
+ */
+# if defined(CONFIG_AUTOBOOT_KEYED)
+static int abortboot_keyed(int bootdelay)
+{
+       int abort = 0;
+       uint64_t etime = endtick(bootdelay);
+       struct {
+               char *str;
+               u_int len;
+               int retry;
+       }
+       delaykey[] = {
+               { str: getenv("bootdelaykey"),  retry: 1 },
+               { str: getenv("bootdelaykey2"), retry: 1 },
+               { str: getenv("bootstopkey"),   retry: 0 },
+               { str: getenv("bootstopkey2"),  retry: 0 },
+       };
+
+       char presskey[MAX_DELAY_STOP_STR];
+       u_int presskey_len = 0;
+       u_int presskey_max = 0;
+       u_int i;
+
+#ifndef CONFIG_ZERO_BOOTDELAY_CHECK
+       if (bootdelay == 0)
+               return 0;
+#endif
+
+#  ifdef CONFIG_AUTOBOOT_PROMPT
+       printf(CONFIG_AUTOBOOT_PROMPT);
+#  endif
+
+#  ifdef CONFIG_AUTOBOOT_DELAY_STR
+       if (delaykey[0].str == NULL)
+               delaykey[0].str = CONFIG_AUTOBOOT_DELAY_STR;
+#  endif
+#  ifdef CONFIG_AUTOBOOT_DELAY_STR2
+       if (delaykey[1].str == NULL)
+               delaykey[1].str = CONFIG_AUTOBOOT_DELAY_STR2;
+#  endif
+#  ifdef CONFIG_AUTOBOOT_STOP_STR
+       if (delaykey[2].str == NULL)
+               delaykey[2].str = CONFIG_AUTOBOOT_STOP_STR;
+#  endif
+#  ifdef CONFIG_AUTOBOOT_STOP_STR2
+       if (delaykey[3].str == NULL)
+               delaykey[3].str = CONFIG_AUTOBOOT_STOP_STR2;
+#  endif
+
+       for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i++) {
+               delaykey[i].len = delaykey[i].str == NULL ?
+                                   0 : strlen(delaykey[i].str);
+               delaykey[i].len = delaykey[i].len > MAX_DELAY_STOP_STR ?
+                                   MAX_DELAY_STOP_STR : delaykey[i].len;
+
+               presskey_max = presskey_max > delaykey[i].len ?
+                                   presskey_max : delaykey[i].len;
+
+               debug_bootkeys("%s key:<%s>\n",
+                              delaykey[i].retry ? "delay" : "stop",
+                              delaykey[i].str ? delaykey[i].str : "NULL");
+       }
+
+       /* In order to keep up with incoming data, check timeout only
+        * when catch up.
+        */
+       do {
+               if (tstc()) {
+                       if (presskey_len < presskey_max) {
+                               presskey[presskey_len++] = getc();
+                       } else {
+                               for (i = 0; i < presskey_max - 1; i++)
+                                       presskey[i] = presskey[i + 1];
+
+                               presskey[i] = getc();
+                       }
+               }
+
+               for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i++) {
+                       if (delaykey[i].len > 0 &&
+                           presskey_len >= delaykey[i].len &&
+                               memcmp(presskey + presskey_len -
+                                       delaykey[i].len, delaykey[i].str,
+                                       delaykey[i].len) == 0) {
+                                       debug_bootkeys("got %skey\n",
+                                               delaykey[i].retry ? "delay" :
+                                               "stop");
+
+                               /* don't retry auto boot */
+                               if (!delaykey[i].retry)
+                                       bootretry_dont_retry();
+                               abort = 1;
+                       }
+               }
+       } while (!abort && get_ticks() <= etime);
+
+       if (!abort)
+               debug_bootkeys("key timeout\n");
+
+#ifdef CONFIG_SILENT_CONSOLE
+       if (abort)
+               gd->flags &= ~GD_FLG_SILENT;
+#endif
+
+       return abort;
+}
+
+# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
+
+#ifdef CONFIG_MENUKEY
+static int menukey;
+#endif
+
+static int abortboot_normal(int bootdelay)
+{
+       int abort = 0;
+       unsigned long ts;
+
+#ifdef CONFIG_MENUPROMPT
+       printf(CONFIG_MENUPROMPT);
+#else
+       if (bootdelay >= 0)
+               printf("Hit any key to stop autoboot: %2d ", bootdelay);
+#endif
+
+#if defined CONFIG_ZERO_BOOTDELAY_CHECK
+       /*
+        * Check if key already pressed
+        * Don't check if bootdelay < 0
+        */
+       if (bootdelay >= 0) {
+               if (tstc()) {   /* we got a key press   */
+                       (void) getc();  /* consume input        */
+                       puts("\b\b\b 0");
+                       abort = 1;      /* don't auto boot      */
+               }
+       }
+#endif
+
+       while ((bootdelay > 0) && (!abort)) {
+               --bootdelay;
+               /* delay 1000 ms */
+               ts = get_timer(0);
+               do {
+                       if (tstc()) {   /* we got a key press   */
+                               abort  = 1;     /* don't auto boot      */
+                               bootdelay = 0;  /* no more delay        */
+# ifdef CONFIG_MENUKEY
+                               menukey = getc();
+# else
+                               (void) getc();  /* consume input        */
+# endif
+                               break;
+                       }
+                       udelay(10000);
+               } while (!abort && get_timer(ts) < 1000);
+
+               printf("\b\b\b%2d ", bootdelay);
+       }
+
+       putc('\n');
+
+#ifdef CONFIG_SILENT_CONSOLE
+       if (abort)
+               gd->flags &= ~GD_FLG_SILENT;
+#endif
+
+       return abort;
+}
+# endif        /* CONFIG_AUTOBOOT_KEYED */
+
+static int abortboot(int bootdelay)
+{
+#ifdef CONFIG_AUTOBOOT_KEYED
+       return abortboot_keyed(bootdelay);
+#else
+       return abortboot_normal(bootdelay);
+#endif
+}
+
+static void process_fdt_options(const void *blob)
+{
+#if defined(CONFIG_OF_CONTROL)
+       ulong addr;
+
+       /* Add an env variable to point to a kernel payload, if available */
+       addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
+       if (addr)
+               setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+
+       /* Add an env variable to point to a root disk, if available */
+       addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
+       if (addr)
+               setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+#endif /* CONFIG_OF_CONTROL */
+}
+
+const char *bootdelay_process(void)
+{
+       char *s;
+       int bootdelay;
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+       unsigned long bootcount = 0;
+       unsigned long bootlimit = 0;
+#endif /* CONFIG_BOOTCOUNT_LIMIT */
+
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+       bootcount = bootcount_load();
+       bootcount++;
+       bootcount_store(bootcount);
+       setenv_ulong("bootcount", bootcount);
+       bootlimit = getenv_ulong("bootlimit", 10, 0);
+#endif /* CONFIG_BOOTCOUNT_LIMIT */
+
+       s = getenv("bootdelay");
+       bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
+
+#ifdef CONFIG_OF_CONTROL
+       bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
+                       bootdelay);
+#endif
+
+       debug("### main_loop entered: bootdelay=%d\n\n", bootdelay);
+
+#if defined(CONFIG_MENU_SHOW)
+       bootdelay = menu_show(bootdelay);
+#endif
+       bootretry_init_cmd_timeout();
+
+#ifdef CONFIG_POST
+       if (gd->flags & GD_FLG_POSTFAIL) {
+               s = getenv("failbootcmd");
+       } else
+#endif /* CONFIG_POST */
+#ifdef CONFIG_BOOTCOUNT_LIMIT
+       if (bootlimit && (bootcount > bootlimit)) {
+               printf("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
+                      (unsigned)bootlimit);
+               s = getenv("altbootcmd");
+       } else
+#endif /* CONFIG_BOOTCOUNT_LIMIT */
+               s = getenv("bootcmd");
+
+       process_fdt_options(gd->fdt_blob);
+       stored_bootdelay = bootdelay;
+
+       return s;
+}
+
+void autoboot_command(const char *s)
+{
+       debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
+
+       if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
+#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
+               int prev = disable_ctrlc(1);    /* disable Control C checking */
+#endif
+
+               run_command_list(s, -1, 0);
+
+#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
+               disable_ctrlc(prev);    /* restore Control C checking */
+#endif
+       }
+
+#ifdef CONFIG_MENUKEY
+       if (menukey == CONFIG_MENUKEY) {
+               s = getenv("menucmd");
+               if (s)
+                       run_command_list(s, -1, 0);
+       }
+#endif /* CONFIG_MENUKEY */
+}
index d1f0aa9b1ad12272bb657d6fabbad382d72ad746..602a239380d02951793b1d6cb34cc1c5be686f37 100644 (file)
@@ -704,17 +704,6 @@ static int initr_kbd(void)
 }
 #endif
 
-#ifdef CONFIG_MODEM_SUPPORT
-static int initr_modem(void)
-{
-       /* TODO: with new initcalls, move this into the driver */
-       extern int do_mdm_init;
-
-       do_mdm_init = gd->do_mdm_init;
-       return 0;
-}
-#endif
-
 static int run_main_loop(void)
 {
 #ifdef CONFIG_SANDBOX
@@ -928,9 +917,6 @@ init_fnc_t init_sequence_r[] = {
 #endif
 #ifdef CONFIG_PS2KBD
        initr_kbd,
-#endif
-#ifdef CONFIG_MODEM_SUPPORT
-       initr_modem,
 #endif
        run_main_loop,
 };
diff --git a/common/bootretry.c b/common/bootretry.c
new file mode 100644 (file)
index 0000000..2d82798
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <bootretry.h>
+#include <cli.h>
+#include <errno.h>
+#include <watchdog.h>
+
+#ifndef CONFIG_BOOT_RETRY_MIN
+#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
+#endif
+
+static uint64_t endtime;  /* must be set, default is instant timeout */
+static int      retry_time = -1; /* -1 so can call readline before main_loop */
+
+/***************************************************************************
+ * initialize command line timeout
+ */
+void bootretry_init_cmd_timeout(void)
+{
+       char *s = getenv("bootretry");
+
+       if (s != NULL)
+               retry_time = (int)simple_strtol(s, NULL, 10);
+       else
+               retry_time = CONFIG_BOOT_RETRY_TIME;
+
+       if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
+               retry_time = CONFIG_BOOT_RETRY_MIN;
+}
+
+/***************************************************************************
+ * reset command line timeout to retry_time seconds
+ */
+void bootretry_reset_cmd_timeout(void)
+{
+       endtime = endtick(retry_time);
+}
+
+int bootretry_tstc_timeout(void)
+{
+       while (!tstc()) {       /* while no incoming data */
+               if (retry_time >= 0 && get_ticks() > endtime)
+                       return -ETIMEDOUT;
+               WATCHDOG_RESET();
+       }
+
+       return 0;
+}
+
+void bootretry_dont_retry(void)
+{
+       retry_time = -1;
+}
diff --git a/common/cli.c b/common/cli.c
new file mode 100644 (file)
index 0000000..ea6bfb3
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Add to readline cmdline-editing by
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <cli.h>
+#include <cli_hush.h>
+#include <fdtdec.h>
+#include <malloc.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Run a command using the selected parser.
+ *
+ * @param cmd  Command to run
+ * @param flag Execution flags (CMD_FLAG_...)
+ * @return 0 on success, or != 0 on error.
+ */
+int run_command(const char *cmd, int flag)
+{
+#ifndef CONFIG_SYS_HUSH_PARSER
+       /*
+        * cli_run_command can return 0 or 1 for success, so clean up
+        * its result.
+        */
+       if (cli_simple_run_command(cmd, flag) == -1)
+               return 1;
+
+       return 0;
+#else
+       return parse_string_outer(cmd,
+                       FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
+#endif
+}
+
+int run_command_list(const char *cmd, int len, int flag)
+{
+       int need_buff = 1;
+       char *buff = (char *)cmd;       /* cast away const */
+       int rcode = 0;
+
+       if (len == -1) {
+               len = strlen(cmd);
+#ifdef CONFIG_SYS_HUSH_PARSER
+               /* hush will never change our string */
+               need_buff = 0;
+#else
+               /* the built-in parser will change our string if it sees \n */
+               need_buff = strchr(cmd, '\n') != NULL;
+#endif
+       }
+       if (need_buff) {
+               buff = malloc(len + 1);
+               if (!buff)
+                       return 1;
+               memcpy(buff, cmd, len);
+               buff[len] = '\0';
+       }
+#ifdef CONFIG_SYS_HUSH_PARSER
+       rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON);
+#else
+       /*
+        * This function will overwrite any \n it sees with a \0, which
+        * is why it can't work with a const char *. Here we are making
+        * using of internal knowledge of this function, to avoid always
+        * doing a malloc() which is actually required only in a case that
+        * is pretty rare.
+        */
+       rcode = cli_simple_run_command_list(buff, flag);
+       if (need_buff)
+               free(buff);
+#endif
+
+       return rcode;
+}
+
+/****************************************************************************/
+
+#if defined(CONFIG_CMD_RUN)
+int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       int i;
+
+       if (argc < 2)
+               return CMD_RET_USAGE;
+
+       for (i = 1; i < argc; ++i) {
+               char *arg;
+
+               arg = getenv(argv[i]);
+               if (arg == NULL) {
+                       printf("## Error: \"%s\" not defined\n", argv[i]);
+                       return 1;
+               }
+
+               if (run_command(arg, flag) != 0)
+                       return 1;
+       }
+       return 0;
+}
+#endif
+
+#ifdef CONFIG_OF_CONTROL
+bool cli_process_fdt(const char **cmdp)
+{
+       /* Allow the fdt to override the boot command */
+       char *env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
+       if (env)
+               *cmdp = env;
+       /*
+        * If the bootsecure option was chosen, use secure_boot_cmd().
+        * Always use 'env' in this case, since bootsecure requres that the
+        * bootcmd was specified in the FDT too.
+        */
+       return fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0) != 0;
+}
+
+/*
+ * Runs the given boot command securely.  Specifically:
+ * - Doesn't run the command with the shell (run_command or parse_string_outer),
+ *   since that's a lot of code surface that an attacker might exploit.
+ *   Because of this, we don't do any argument parsing--the secure boot command
+ *   has to be a full-fledged u-boot command.
+ * - Doesn't check for keypresses before booting, since that could be a
+ *   security hole; also disables Ctrl-C.
+ * - Doesn't allow the command to return.
+ *
+ * Upon any failures, this function will drop into an infinite loop after
+ * printing the error message to console.
+ */
+void cli_secure_boot_cmd(const char *cmd)
+{
+       cmd_tbl_t *cmdtp;
+       int rc;
+
+       if (!cmd) {
+               printf("## Error: Secure boot command not specified\n");
+               goto err;
+       }
+
+       /* Disable Ctrl-C just in case some command is used that checks it. */
+       disable_ctrlc(1);
+
+       /* Find the command directly. */
+       cmdtp = find_cmd(cmd);
+       if (!cmdtp) {
+               printf("## Error: \"%s\" not defined\n", cmd);
+               goto err;
+       }
+
+       /* Run the command, forcing no flags and faking argc and argv. */
+       rc = (cmdtp->cmd)(cmdtp, 0, 1, (char **)&cmd);
+
+       /* Shouldn't ever return from boot command. */
+       printf("## Error: \"%s\" returned (code %d)\n", cmd, rc);
+
+err:
+       /*
+        * Not a whole lot to do here.  Rebooting won't help much, since we'll
+        * just end up right back here.  Just loop.
+        */
+       hang();
+}
+#endif /* CONFIG_OF_CONTROL */
+
+void cli_loop(void)
+{
+#ifdef CONFIG_SYS_HUSH_PARSER
+       parse_file_outer();
+       /* This point is never reached */
+       for (;;);
+#else
+       cli_simple_loop();
+#endif /*CONFIG_SYS_HUSH_PARSER*/
+}
+
+void cli_init(void)
+{
+#ifdef CONFIG_SYS_HUSH_PARSER
+       u_boot_hush_start();
+#endif
+
+#if defined(CONFIG_HUSH_INIT_VAR)
+       hush_init_var();
+#endif
+}
similarity index 99%
rename from common/hush.c
rename to common/cli_hush.c
index 5b432247599fc521cc184d7ca0b81c8109ee4f8e..0f069b010a2d39975635574fdbd5dc36554c09d4 100644 (file)
@@ -79,7 +79,9 @@
 #include <malloc.h>         /* malloc, free, realloc*/
 #include <linux/ctype.h>    /* isalpha, isdigit */
 #include <common.h>        /* readline */
-#include <hush.h>
+#include <bootretry.h>
+#include <cli.h>
+#include <cli_hush.h>
 #include <command.h>        /* find_cmd */
 #ifndef CONFIG_SYS_PROMPT_HUSH_PS2
 #define CONFIG_SYS_PROMPT_HUSH_PS2     "> "
@@ -222,7 +224,7 @@ struct child_prog {
 #endif
        char **argv;                            /* program name and arguments */
        /* was quoted when parsed; copy of struct o_string.nonnull field */
-       int *argv_nonnull;                      
+       int *argv_nonnull;
 #ifdef __U_BOOT__
        int    argc;                            /* number of program arguments */
 #endif
@@ -998,17 +1000,12 @@ static void get_user_input(struct in_str *i)
        int n;
        static char the_command[CONFIG_SYS_CBSIZE + 1];
 
-#ifdef CONFIG_BOOT_RETRY_TIME
-#  ifndef CONFIG_RESET_TO_RETRY
-#      error "This currently only works with CONFIG_RESET_TO_RETRY enabled"
-#  endif
-       reset_cmd_timeout();
-#endif
+       bootretry_reset_cmd_timeout();
        i->__promptme = 1;
        if (i->promptmode == 1) {
-               n = readline(CONFIG_SYS_PROMPT);
+               n = cli_readline(CONFIG_SYS_PROMPT);
        } else {
-               n = readline(CONFIG_SYS_PROMPT_HUSH_PS2);
+               n = cli_readline(CONFIG_SYS_PROMPT_HUSH_PS2);
        }
 #ifdef CONFIG_BOOT_RETRY_TIME
        if (n == -2) {
diff --git a/common/cli_readline.c b/common/cli_readline.c
new file mode 100644 (file)
index 0000000..9a9fb35
--- /dev/null
@@ -0,0 +1,621 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Add to readline cmdline-editing by
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <bootretry.h>
+#include <cli.h>
+#include <watchdog.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const char erase_seq[] = "\b \b";       /* erase sequence */
+static const char   tab_seq[] = "        ";    /* used to expand TABs */
+
+char console_buffer[CONFIG_SYS_CBSIZE + 1];    /* console I/O buffer   */
+
+static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen)
+{
+       char *s;
+
+       if (*np == 0)
+               return p;
+
+       if (*(--p) == '\t') {           /* will retype the whole line */
+               while (*colp > plen) {
+                       puts(erase_seq);
+                       (*colp)--;
+               }
+               for (s = buffer; s < p; ++s) {
+                       if (*s == '\t') {
+                               puts(tab_seq + ((*colp) & 07));
+                               *colp += 8 - ((*colp) & 07);
+                       } else {
+                               ++(*colp);
+                               putc(*s);
+                       }
+               }
+       } else {
+               puts(erase_seq);
+               (*colp)--;
+       }
+       (*np)--;
+
+       return p;
+}
+
+#ifdef CONFIG_CMDLINE_EDITING
+
+/*
+ * cmdline-editing related codes from vivi.
+ * Author: Janghoon Lyu <nandy@mizi.com>
+ */
+
+#define putnstr(str, n)        printf("%.*s", (int)n, str)
+
+#define CTL_CH(c)              ((c) - 'a' + 1)
+#define CTL_BACKSPACE          ('\b')
+#define DEL                    ((char)255)
+#define DEL7                   ((char)127)
+#define CREAD_HIST_CHAR                ('!')
+
+#define getcmd_putch(ch)       putc(ch)
+#define getcmd_getch()         getc()
+#define getcmd_cbeep()         getcmd_putch('\a')
+
+#define HIST_MAX               20
+#define HIST_SIZE              CONFIG_SYS_CBSIZE
+
+static int hist_max;
+static int hist_add_idx;
+static int hist_cur = -1;
+static unsigned hist_num;
+
+static char *hist_list[HIST_MAX];
+static char hist_lines[HIST_MAX][HIST_SIZE + 1];       /* Save room for NULL */
+
+#define add_idx_minus_one() ((hist_add_idx == 0) ? hist_max : hist_add_idx-1)
+
+static void hist_init(void)
+{
+       int i;
+
+       hist_max = 0;
+       hist_add_idx = 0;
+       hist_cur = -1;
+       hist_num = 0;
+
+       for (i = 0; i < HIST_MAX; i++) {
+               hist_list[i] = hist_lines[i];
+               hist_list[i][0] = '\0';
+       }
+}
+
+static void cread_add_to_hist(char *line)
+{
+       strcpy(hist_list[hist_add_idx], line);
+
+       if (++hist_add_idx >= HIST_MAX)
+               hist_add_idx = 0;
+
+       if (hist_add_idx > hist_max)
+               hist_max = hist_add_idx;
+
+       hist_num++;
+}
+
+static char *hist_prev(void)
+{
+       char *ret;
+       int old_cur;
+
+       if (hist_cur < 0)
+               return NULL;
+
+       old_cur = hist_cur;
+       if (--hist_cur < 0)
+               hist_cur = hist_max;
+
+       if (hist_cur == hist_add_idx) {
+               hist_cur = old_cur;
+               ret = NULL;
+       } else {
+               ret = hist_list[hist_cur];
+       }
+
+       return ret;
+}
+
+static char *hist_next(void)
+{
+       char *ret;
+
+       if (hist_cur < 0)
+               return NULL;
+
+       if (hist_cur == hist_add_idx)
+               return NULL;
+
+       if (++hist_cur > hist_max)
+               hist_cur = 0;
+
+       if (hist_cur == hist_add_idx)
+               ret = "";
+       else
+               ret = hist_list[hist_cur];
+
+       return ret;
+}
+
+#ifndef CONFIG_CMDLINE_EDITING
+static void cread_print_hist_list(void)
+{
+       int i;
+       unsigned long n;
+
+       n = hist_num - hist_max;
+
+       i = hist_add_idx + 1;
+       while (1) {
+               if (i > hist_max)
+                       i = 0;
+               if (i == hist_add_idx)
+                       break;
+               printf("%s\n", hist_list[i]);
+               n++;
+               i++;
+       }
+}
+#endif /* CONFIG_CMDLINE_EDITING */
+
+#define BEGINNING_OF_LINE() {                  \
+       while (num) {                           \
+               getcmd_putch(CTL_BACKSPACE);    \
+               num--;                          \
+       }                                       \
+}
+
+#define ERASE_TO_EOL() {                               \
+       if (num < eol_num) {                            \
+               printf("%*s", (int)(eol_num - num), ""); \
+               do {                                    \
+                       getcmd_putch(CTL_BACKSPACE);    \
+               } while (--eol_num > num);              \
+       }                                               \
+}
+
+#define REFRESH_TO_EOL() {                     \
+       if (num < eol_num) {                    \
+               wlen = eol_num - num;           \
+               putnstr(buf + num, wlen);       \
+               num = eol_num;                  \
+       }                                       \
+}
+
+static void cread_add_char(char ichar, int insert, unsigned long *num,
+              unsigned long *eol_num, char *buf, unsigned long len)
+{
+       unsigned long wlen;
+
+       /* room ??? */
+       if (insert || *num == *eol_num) {
+               if (*eol_num > len - 1) {
+                       getcmd_cbeep();
+                       return;
+               }
+               (*eol_num)++;
+       }
+
+       if (insert) {
+               wlen = *eol_num - *num;
+               if (wlen > 1)
+                       memmove(&buf[*num+1], &buf[*num], wlen-1);
+
+               buf[*num] = ichar;
+               putnstr(buf + *num, wlen);
+               (*num)++;
+               while (--wlen)
+                       getcmd_putch(CTL_BACKSPACE);
+       } else {
+               /* echo the character */
+               wlen = 1;
+               buf[*num] = ichar;
+               putnstr(buf + *num, wlen);
+               (*num)++;
+       }
+}
+
+static void cread_add_str(char *str, int strsize, int insert,
+                         unsigned long *num, unsigned long *eol_num,
+                         char *buf, unsigned long len)
+{
+       while (strsize--) {
+               cread_add_char(*str, insert, num, eol_num, buf, len);
+               str++;
+       }
+}
+
+static int cread_line(const char *const prompt, char *buf, unsigned int *len,
+               int timeout)
+{
+       unsigned long num = 0;
+       unsigned long eol_num = 0;
+       unsigned long wlen;
+       char ichar;
+       int insert = 1;
+       int esc_len = 0;
+       char esc_save[8];
+       int init_len = strlen(buf);
+       int first = 1;
+
+       if (init_len)
+               cread_add_str(buf, init_len, 1, &num, &eol_num, buf, *len);
+
+       while (1) {
+               if (bootretry_tstc_timeout())
+                       return -2;      /* timed out */
+               if (first && timeout) {
+                       uint64_t etime = endtick(timeout);
+
+                       while (!tstc()) {       /* while no incoming data */
+                               if (get_ticks() >= etime)
+                                       return -2;      /* timed out */
+                               WATCHDOG_RESET();
+                       }
+                       first = 0;
+               }
+
+               ichar = getcmd_getch();
+
+               if ((ichar == '\n') || (ichar == '\r')) {
+                       putc('\n');
+                       break;
+               }
+
+               /*
+                * handle standard linux xterm esc sequences for arrow key, etc.
+                */
+               if (esc_len != 0) {
+                       if (esc_len == 1) {
+                               if (ichar == '[') {
+                                       esc_save[esc_len] = ichar;
+                                       esc_len = 2;
+                               } else {
+                                       cread_add_str(esc_save, esc_len,
+                                                     insert, &num, &eol_num,
+                                                     buf, *len);
+                                       esc_len = 0;
+                               }
+                               continue;
+                       }
+
+                       switch (ichar) {
+                       case 'D':       /* <- key */
+                               ichar = CTL_CH('b');
+                               esc_len = 0;
+                               break;
+                       case 'C':       /* -> key */
+                               ichar = CTL_CH('f');
+                               esc_len = 0;
+                               break;  /* pass off to ^F handler */
+                       case 'H':       /* Home key */
+                               ichar = CTL_CH('a');
+                               esc_len = 0;
+                               break;  /* pass off to ^A handler */
+                       case 'A':       /* up arrow */
+                               ichar = CTL_CH('p');
+                               esc_len = 0;
+                               break;  /* pass off to ^P handler */
+                       case 'B':       /* down arrow */
+                               ichar = CTL_CH('n');
+                               esc_len = 0;
+                               break;  /* pass off to ^N handler */
+                       default:
+                               esc_save[esc_len++] = ichar;
+                               cread_add_str(esc_save, esc_len, insert,
+                                             &num, &eol_num, buf, *len);
+                               esc_len = 0;
+                               continue;
+                       }
+               }
+
+               switch (ichar) {
+               case 0x1b:
+                       if (esc_len == 0) {
+                               esc_save[esc_len] = ichar;
+                               esc_len = 1;
+                       } else {
+                               puts("impossible condition #876\n");
+                               esc_len = 0;
+                       }
+                       break;
+
+               case CTL_CH('a'):
+                       BEGINNING_OF_LINE();
+                       break;
+               case CTL_CH('c'):       /* ^C - break */
+                       *buf = '\0';    /* discard input */
+                       return -1;
+               case CTL_CH('f'):
+                       if (num < eol_num) {
+                               getcmd_putch(buf[num]);
+                               num++;
+                       }
+                       break;
+               case CTL_CH('b'):
+                       if (num) {
+                               getcmd_putch(CTL_BACKSPACE);
+                               num--;
+                       }
+                       break;
+               case CTL_CH('d'):
+                       if (num < eol_num) {
+                               wlen = eol_num - num - 1;
+                               if (wlen) {
+                                       memmove(&buf[num], &buf[num+1], wlen);
+                                       putnstr(buf + num, wlen);
+                               }
+
+                               getcmd_putch(' ');
+                               do {
+                                       getcmd_putch(CTL_BACKSPACE);
+                               } while (wlen--);
+                               eol_num--;
+                       }
+                       break;
+               case CTL_CH('k'):
+                       ERASE_TO_EOL();
+                       break;
+               case CTL_CH('e'):
+                       REFRESH_TO_EOL();
+                       break;
+               case CTL_CH('o'):
+                       insert = !insert;
+                       break;
+               case CTL_CH('x'):
+               case CTL_CH('u'):
+                       BEGINNING_OF_LINE();
+                       ERASE_TO_EOL();
+                       break;
+               case DEL:
+               case DEL7:
+               case 8:
+                       if (num) {
+                               wlen = eol_num - num;
+                               num--;
+                               memmove(&buf[num], &buf[num+1], wlen);
+                               getcmd_putch(CTL_BACKSPACE);
+                               putnstr(buf + num, wlen);
+                               getcmd_putch(' ');
+                               do {
+                                       getcmd_putch(CTL_BACKSPACE);
+                               } while (wlen--);
+                               eol_num--;
+                       }
+                       break;
+               case CTL_CH('p'):
+               case CTL_CH('n'):
+               {
+                       char *hline;
+
+                       esc_len = 0;
+
+                       if (ichar == CTL_CH('p'))
+                               hline = hist_prev();
+                       else
+                               hline = hist_next();
+
+                       if (!hline) {
+                               getcmd_cbeep();
+                               continue;
+                       }
+
+                       /* nuke the current line */
+                       /* first, go home */
+                       BEGINNING_OF_LINE();
+
+                       /* erase to end of line */
+                       ERASE_TO_EOL();
+
+                       /* copy new line into place and display */
+                       strcpy(buf, hline);
+                       eol_num = strlen(buf);
+                       REFRESH_TO_EOL();
+                       continue;
+               }
+#ifdef CONFIG_AUTO_COMPLETE
+               case '\t': {
+                       int num2, col;
+
+                       /* do not autocomplete when in the middle */
+                       if (num < eol_num) {
+                               getcmd_cbeep();
+                               break;
+                       }
+
+                       buf[num] = '\0';
+                       col = strlen(prompt) + eol_num;
+                       num2 = num;
+                       if (cmd_auto_complete(prompt, buf, &num2, &col)) {
+                               col = num2 - num;
+                               num += col;
+                               eol_num += col;
+                       }
+                       break;
+               }
+#endif
+               default:
+                       cread_add_char(ichar, insert, &num, &eol_num, buf,
+                                      *len);
+                       break;
+               }
+       }
+       *len = eol_num;
+       buf[eol_num] = '\0';    /* lose the newline */
+
+       if (buf[0] && buf[0] != CREAD_HIST_CHAR)
+               cread_add_to_hist(buf);
+       hist_cur = hist_add_idx;
+
+       return 0;
+}
+
+#endif /* CONFIG_CMDLINE_EDITING */
+
+/****************************************************************************/
+
+int cli_readline(const char *const prompt)
+{
+       /*
+        * If console_buffer isn't 0-length the user will be prompted to modify
+        * it instead of entering it from scratch as desired.
+        */
+       console_buffer[0] = '\0';
+
+       return cli_readline_into_buffer(prompt, console_buffer, 0);
+}
+
+
+int cli_readline_into_buffer(const char *const prompt, char *buffer,
+                            int timeout)
+{
+       char *p = buffer;
+#ifdef CONFIG_CMDLINE_EDITING
+       unsigned int len = CONFIG_SYS_CBSIZE;
+       int rc;
+       static int initted;
+
+       /*
+        * History uses a global array which is not
+        * writable until after relocation to RAM.
+        * Revert to non-history version if still
+        * running from flash.
+        */
+       if (gd->flags & GD_FLG_RELOC) {
+               if (!initted) {
+                       hist_init();
+                       initted = 1;
+               }
+
+               if (prompt)
+                       puts(prompt);
+
+               rc = cread_line(prompt, p, &len, timeout);
+               return rc < 0 ? rc : len;
+
+       } else {
+#endif /* CONFIG_CMDLINE_EDITING */
+       char *p_buf = p;
+       int     n = 0;                          /* buffer index         */
+       int     plen = 0;                       /* prompt length        */
+       int     col;                            /* output column cnt    */
+       char    c;
+
+       /* print prompt */
+       if (prompt) {
+               plen = strlen(prompt);
+               puts(prompt);
+       }
+       col = plen;
+
+       for (;;) {
+               if (bootretry_tstc_timeout())
+                       return -2;      /* timed out */
+               WATCHDOG_RESET();       /* Trigger watchdog, if needed */
+
+#ifdef CONFIG_SHOW_ACTIVITY
+               while (!tstc()) {
+                       show_activity(0);
+                       WATCHDOG_RESET();
+               }
+#endif
+               c = getc();
+
+               /*
+                * Special character handling
+                */
+               switch (c) {
+               case '\r':                      /* Enter                */
+               case '\n':
+                       *p = '\0';
+                       puts("\r\n");
+                       return p - p_buf;
+
+               case '\0':                      /* nul                  */
+                       continue;
+
+               case 0x03:                      /* ^C - break           */
+                       p_buf[0] = '\0';        /* discard input */
+                       return -1;
+
+               case 0x15:                      /* ^U - erase line      */
+                       while (col > plen) {
+                               puts(erase_seq);
+                               --col;
+                       }
+                       p = p_buf;
+                       n = 0;
+                       continue;
+
+               case 0x17:                      /* ^W - erase word      */
+                       p = delete_char(p_buf, p, &col, &n, plen);
+                       while ((n > 0) && (*p != ' '))
+                               p = delete_char(p_buf, p, &col, &n, plen);
+                       continue;
+
+               case 0x08:                      /* ^H  - backspace      */
+               case 0x7F:                      /* DEL - backspace      */
+                       p = delete_char(p_buf, p, &col, &n, plen);
+                       continue;
+
+               default:
+                       /*
+                        * Must be a normal character then
+                        */
+                       if (n < CONFIG_SYS_CBSIZE-2) {
+                               if (c == '\t') {        /* expand TABs */
+#ifdef CONFIG_AUTO_COMPLETE
+                                       /*
+                                        * if auto completion triggered just
+                                        * continue
+                                        */
+                                       *p = '\0';
+                                       if (cmd_auto_complete(prompt,
+                                                             console_buffer,
+                                                             &n, &col)) {
+                                               p = p_buf + n;  /* reset */
+                                               continue;
+                                       }
+#endif
+                                       puts(tab_seq + (col & 07));
+                                       col += 8 - (col & 07);
+                               } else {
+                                       char buf[2];
+
+                                       /*
+                                        * Echo input using puts() to force an
+                                        * LCD flush if we are using an LCD
+                                        */
+                                       ++col;
+                                       buf[0] = c;
+                                       buf[1] = '\0';
+                                       puts(buf);
+                               }
+                               *p++ = c;
+                               ++n;
+                       } else {                        /* Buffer full */
+                               putc('\a');
+                       }
+               }
+       }
+#ifdef CONFIG_CMDLINE_EDITING
+       }
+#endif
+}
diff --git a/common/cli_simple.c b/common/cli_simple.c
new file mode 100644 (file)
index 0000000..413c2eb
--- /dev/null
@@ -0,0 +1,337 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Add to readline cmdline-editing by
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <bootretry.h>
+#include <cli.h>
+#include <linux/ctype.h>
+
+#define DEBUG_PARSER   0       /* set to 1 to debug */
+
+#define debug_parser(fmt, args...)             \
+       debug_cond(DEBUG_PARSER, fmt, ##args)
+
+
+int cli_simple_parse_line(char *line, char *argv[])
+{
+       int nargs = 0;
+
+       debug_parser("%s: \"%s\"\n", __func__, line);
+       while (nargs < CONFIG_SYS_MAXARGS) {
+               /* skip any white space */
+               while (isblank(*line))
+                       ++line;
+
+               if (*line == '\0') {    /* end of line, no more args    */
+                       argv[nargs] = NULL;
+                       debug_parser("%s: nargs=%d\n", __func__, nargs);
+                       return nargs;
+               }
+
+               argv[nargs++] = line;   /* begin of argument string     */
+
+               /* find end of string */
+               while (*line && !isblank(*line))
+                       ++line;
+
+               if (*line == '\0') {    /* end of line, no more args    */
+                       argv[nargs] = NULL;
+                       debug_parser("parse_line: nargs=%d\n", nargs);
+                       return nargs;
+               }
+
+               *line++ = '\0';         /* terminate current arg         */
+       }
+
+       printf("** Too many args (max. %d) **\n", CONFIG_SYS_MAXARGS);
+
+       debug_parser("%s: nargs=%d\n", __func__, nargs);
+       return nargs;
+}
+
+static void process_macros(const char *input, char *output)
+{
+       char c, prev;
+       const char *varname_start = NULL;
+       int inputcnt = strlen(input);
+       int outputcnt = CONFIG_SYS_CBSIZE;
+       int state = 0;          /* 0 = waiting for '$'  */
+
+       /* 1 = waiting for '(' or '{' */
+       /* 2 = waiting for ')' or '}' */
+       /* 3 = waiting for '''  */
+       char *output_start = output;
+
+       debug_parser("[PROCESS_MACROS] INPUT len %zd: \"%s\"\n", strlen(input),
+                    input);
+
+       prev = '\0';            /* previous character   */
+
+       while (inputcnt && outputcnt) {
+               c = *input++;
+               inputcnt--;
+
+               if (state != 3) {
+                       /* remove one level of escape characters */
+                       if ((c == '\\') && (prev != '\\')) {
+                               if (inputcnt-- == 0)
+                                       break;
+                               prev = c;
+                               c = *input++;
+                       }
+               }
+
+               switch (state) {
+               case 0: /* Waiting for (unescaped) $    */
+                       if ((c == '\'') && (prev != '\\')) {
+                               state = 3;
+                               break;
+                       }
+                       if ((c == '$') && (prev != '\\')) {
+                               state++;
+                       } else {
+                               *(output++) = c;
+                               outputcnt--;
+                       }
+                       break;
+               case 1: /* Waiting for (        */
+                       if (c == '(' || c == '{') {
+                               state++;
+                               varname_start = input;
+                       } else {
+                               state = 0;
+                               *(output++) = '$';
+                               outputcnt--;
+
+                               if (outputcnt) {
+                                       *(output++) = c;
+                                       outputcnt--;
+                               }
+                       }
+                       break;
+               case 2: /* Waiting for )        */
+                       if (c == ')' || c == '}') {
+                               int i;
+                               char envname[CONFIG_SYS_CBSIZE], *envval;
+                               /* Varname # of chars */
+                               int envcnt = input - varname_start - 1;
+
+                               /* Get the varname */
+                               for (i = 0; i < envcnt; i++)
+                                       envname[i] = varname_start[i];
+                               envname[i] = 0;
+
+                               /* Get its value */
+                               envval = getenv(envname);
+
+                               /* Copy into the line if it exists */
+                               if (envval != NULL)
+                                       while ((*envval) && outputcnt) {
+                                               *(output++) = *(envval++);
+                                               outputcnt--;
+                                       }
+                               /* Look for another '$' */
+                               state = 0;
+                       }
+                       break;
+               case 3: /* Waiting for '        */
+                       if ((c == '\'') && (prev != '\\')) {
+                               state = 0;
+                       } else {
+                               *(output++) = c;
+                               outputcnt--;
+                       }
+                       break;
+               }
+               prev = c;
+       }
+
+       if (outputcnt)
+               *output = 0;
+       else
+               *(output - 1) = 0;
+
+       debug_parser("[PROCESS_MACROS] OUTPUT len %zd: \"%s\"\n",
+                    strlen(output_start), output_start);
+}
+
+ /*
+ * WARNING:
+ *
+ * We must create a temporary copy of the command since the command we get
+ * may be the result from getenv(), which returns a pointer directly to
+ * the environment data, which may change magicly when the command we run
+ * creates or modifies environment variables (like "bootp" does).
+ */
+int cli_simple_run_command(const char *cmd, int flag)
+{
+       char cmdbuf[CONFIG_SYS_CBSIZE]; /* working copy of cmd          */
+       char *token;                    /* start of token in cmdbuf     */
+       char *sep;                      /* end of token (separator) in cmdbuf */
+       char finaltoken[CONFIG_SYS_CBSIZE];
+       char *str = cmdbuf;
+       char *argv[CONFIG_SYS_MAXARGS + 1];     /* NULL terminated      */
+       int argc, inquotes;
+       int repeatable = 1;
+       int rc = 0;
+
+       debug_parser("[RUN_COMMAND] cmd[%p]=\"", cmd);
+       if (DEBUG_PARSER) {
+               /* use puts - string may be loooong */
+               puts(cmd ? cmd : "NULL");
+               puts("\"\n");
+       }
+       clear_ctrlc();          /* forget any previous Control C */
+
+       if (!cmd || !*cmd)
+               return -1;      /* empty command */
+
+       if (strlen(cmd) >= CONFIG_SYS_CBSIZE) {
+               puts("## Command too long!\n");
+               return -1;
+       }
+
+       strcpy(cmdbuf, cmd);
+
+       /* Process separators and check for invalid
+        * repeatable commands
+        */
+
+       debug_parser("[PROCESS_SEPARATORS] %s\n", cmd);
+       while (*str) {
+               /*
+                * Find separator, or string end
+                * Allow simple escape of ';' by writing "\;"
+                */
+               for (inquotes = 0, sep = str; *sep; sep++) {
+                       if ((*sep == '\'') &&
+                           (*(sep - 1) != '\\'))
+                               inquotes = !inquotes;
+
+                       if (!inquotes &&
+                           (*sep == ';') &&    /* separator            */
+                           (sep != str) &&     /* past string start    */
+                           (*(sep - 1) != '\\'))       /* and NOT escaped */
+                               break;
+               }
+
+               /*
+                * Limit the token to data between separators
+                */
+               token = str;
+               if (*sep) {
+                       str = sep + 1;  /* start of command for next pass */
+                       *sep = '\0';
+               } else {
+                       str = sep;      /* no more commands for next pass */
+               }
+               debug_parser("token: \"%s\"\n", token);
+
+               /* find macros in this token and replace them */
+               process_macros(token, finaltoken);
+
+               /* Extract arguments */
+               argc = cli_simple_parse_line(finaltoken, argv);
+               if (argc == 0) {
+                       rc = -1;        /* no command at all */
+                       continue;
+               }
+
+               if (cmd_process(flag, argc, argv, &repeatable, NULL))
+                       rc = -1;
+
+               /* Did the user stop this? */
+               if (had_ctrlc())
+                       return -1;      /* if stopped then not repeatable */
+       }
+
+       return rc ? rc : repeatable;
+}
+
+void cli_simple_loop(void)
+{
+       static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
+
+       int len;
+       int flag;
+       int rc = 1;
+
+       for (;;) {
+               if (rc >= 0) {
+                       /* Saw enough of a valid command to
+                        * restart the timeout.
+                        */
+                       bootretry_reset_cmd_timeout();
+               }
+               len = cli_readline(CONFIG_SYS_PROMPT);
+
+               flag = 0;       /* assume no special flags for now */
+               if (len > 0)
+                       strcpy(lastcommand, console_buffer);
+               else if (len == 0)
+                       flag |= CMD_FLAG_REPEAT;
+#ifdef CONFIG_BOOT_RETRY_TIME
+               else if (len == -2) {
+                       /* -2 means timed out, retry autoboot
+                        */
+                       puts("\nTimed out waiting for command\n");
+# ifdef CONFIG_RESET_TO_RETRY
+                       /* Reinit board to run initialization code again */
+                       do_reset(NULL, 0, 0, NULL);
+# else
+                       return;         /* retry autoboot */
+# endif
+               }
+#endif
+
+               if (len == -1)
+                       puts("<INTERRUPT>\n");
+               else
+                       rc = run_command(lastcommand, flag);
+
+               if (rc <= 0) {
+                       /* invalid command or not repeatable, forget it */
+                       lastcommand[0] = 0;
+               }
+       }
+}
+
+int cli_simple_run_command_list(char *cmd, int flag)
+{
+       char *line, *next;
+       int rcode = 0;
+
+       /*
+        * Break into individual lines, and execute each line; terminate on
+        * error.
+        */
+       next = cmd;
+       line = cmd;
+       while (*next) {
+               if (*next == '\n') {
+                       *next = '\0';
+                       /* run only non-empty commands */
+                       if (*line) {
+                               debug("** exec: \"%s\"\n", line);
+                               if (cli_simple_run_command(line, 0) < 0) {
+                                       rcode = 1;
+                                       break;
+                               }
+                       }
+                       line = next + 1;
+               }
+               ++next;
+       }
+       if (rcode == 0 && *line)
+               rcode = (cli_simple_run_command(line, 0) >= 0);
+
+       return rcode;
+}
index 77b6e3e88e4b72aefdf55ef79cee6c6ffa6b4428..bdcf712d111077a5b12222296686b403b0fc8dee 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include <linux/ctype.h>
 #include <net.h>
@@ -19,7 +20,7 @@ extern int run_command __P ((const char *, int));
 ulong dis_last_addr = 0;       /* Last address disassembled   */
 ulong dis_last_len = 20;       /* Default disassembler length */
 CPU_DEBUG_CTX bug_ctx;         /* Bedbug context structure    */
-\f
+
 
 /* ======================================================================
  * U-Boot's puts function does not append a newline, so the bedbug stuff
@@ -33,7 +34,7 @@ int bedbug_puts (const char *str)
        printf ("%s\r\n", str);
        return 0;
 }                              /* bedbug_puts */
-\f
+
 
 
 /* ======================================================================
@@ -65,7 +66,7 @@ void bedbug_init (void)
 
        return;
 }                              /* bedbug_init */
-\f
+
 
 
 /* ======================================================================
@@ -106,7 +107,7 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (ds, 3, 1, do_bedbug_dis,
            "disassemble memory",
            "ds <address> [# instructions]");
-\f
+
 /* ======================================================================
  * Entry point from the interpreter to the assembler.  Assembles
  * instructions in consecutive memory locations until a '.' (period) is
@@ -134,7 +135,7 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
                        F_RADHEX);
 
                sprintf (prompt, "%08lx:    ", mem_addr);
-               readline (prompt);
+               cli_readline(prompt);
 
                if (console_buffer[0] && strcmp (console_buffer, ".")) {
                        if ((instr =
@@ -156,7 +157,7 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
 U_BOOT_CMD (as, 2, 0, do_bedbug_asm,
            "assemble memory", "as <address>");
-\f
+
 /* ======================================================================
  * Used to set a break point from the interpreter.  Simply calls into the
  * CPU-specific break point set routine.
@@ -177,7 +178,7 @@ U_BOOT_CMD (break, 3, 0, do_bedbug_break,
            "break <address> - Break at an address\n"
            "break off <bp#> - Disable breakpoint.\n"
            "break show      - List breakpoints.");
-\f
+
 /* ======================================================================
  * Called from the debug interrupt routine.  Simply calls the CPU-specific
  * breakpoint handling routine.
@@ -192,7 +193,7 @@ void do_bedbug_breakpoint (struct pt_regs *regs)
 
        return;
 }                              /* do_bedbug_breakpoint */
-\f
+
 
 
 /* ======================================================================
@@ -225,7 +226,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
 
        /* A miniature main loop */
        while (bug_ctx.stopped) {
-               len = readline (prompt_str);
+               len = cli_readline(prompt_str);
 
                flag = 0;       /* assume no special flags for now */
 
@@ -250,7 +251,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs *regs)
 
        return;
 }                              /* bedbug_main_loop */
-\f
+
 
 
 /* ======================================================================
@@ -274,7 +275,7 @@ int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv
 U_BOOT_CMD (continue, 1, 0, do_bedbug_continue,
            "continue from a breakpoint",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to continue to the next instruction, stepping into
  * subroutines.  Works by calling the find_next_addr() routine to compute
@@ -305,7 +306,7 @@ int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (step, 1, 1, do_bedbug_step,
            "single step execution.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to continue to the next instruction, stepping over
  * subroutines.  Works by calling the find_next_addr() routine to compute
@@ -336,7 +337,7 @@ int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (next, 1, 1, do_bedbug_next,
            "single step execution, stepping over subroutines.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to print the current stack.  This assumes an EABI
  * architecture, so it starts with GPR R1 and works back up the stack.
@@ -381,7 +382,7 @@ int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 U_BOOT_CMD (where, 1, 1, do_bedbug_stack,
            "Print the running stack.",
            "");
-\f
+
 /* ======================================================================
  * Interpreter command to dump the registers.  Calls the CPU-specific
  * show registers routine.
index 34b4b583baafc1bb0ca62df3ea89fc7bb2ae2da9..449bb363f554a622d11834dbc149b2951185c6c1 100644 (file)
 #include <usb.h>
 #endif
 
-#ifdef CONFIG_SYS_HUSH_PARSER
-#include <hush.h>
-#endif
-
 #if defined(CONFIG_OF_LIBFDT)
 #include <libfdt.h>
 #include <fdt_support.h>
index 163d5b2e2bdb1119e9f3f8f54ec0e43635726557..5879065c2ea45cc7b9731884aad1aa9a95128340 100644 (file)
@@ -8,7 +8,6 @@
 #include <command.h>
 #include <ansi.h>
 #include <menu.h>
-#include <hush.h>
 #include <watchdog.h>
 #include <malloc.h>
 #include <linux/string.h>
index 896f79f416c3a10128525cb91576fc285945dfd1..4fddd804abd9bbad5b3c682dbe5211151a47b3a0 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <config.h>
 #include <command.h>
 
@@ -62,7 +63,7 @@ int do_setdcr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
        do {
                value = get_dcr (dcrn);
                printf ("%04x: %08lx", dcrn, value);
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0) {
                        /*
                         * <CR> pressed as only input, don't modify current
index a3bba7fdf3c55d27cd7f1e91d1e4135b8b458223..652c61c70779bdab10116e80bca99e554f20a786 100644 (file)
@@ -11,7 +11,7 @@
 #include <dm-demo.h>
 #include <asm/io.h>
 
-struct device *demo_dev;
+struct udevice *demo_dev;
 
 static int do_demo_hello(cmd_tbl_t *cmdtp, int flag, int argc,
                         char * const argv[])
@@ -41,7 +41,7 @@ static int do_demo_status(cmd_tbl_t *cmdtp, int flag, int argc,
 
 int do_demo_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-       struct device *dev;
+       struct udevice *dev;
        int i, ret;
 
        puts("Demo uclass entries:\n");
index aff044518f455e520ca7d9d8ea305ea32ad0d9c3..4634f914e66d97a0bc9fe0f244fb957cf4b544d1 100644 (file)
@@ -30,7 +30,7 @@ static const char * const gpio_function[] = {
        "unknown",
 };
 
-static void show_gpio(struct device *dev, const char *bank_name, int offset)
+static void show_gpio(struct udevice *dev, const char *bank_name, int offset)
 {
        struct dm_gpio_ops *ops = gpio_get_ops(dev);
        char buf[80];
@@ -62,7 +62,7 @@ static void show_gpio(struct device *dev, const char *bank_name, int offset)
 
 static int do_gpio_status(const char *gpio_name)
 {
-       struct device *dev;
+       struct udevice *dev;
        int newline = 0;
        int ret;
 
index ebce7d4c3c05162a675bb4a01fdec15dd287e172..d714658d7f548fc7089e184e6fd8f63c6322a80c 100644 (file)
@@ -66,6 +66,8 @@
  */
 
 #include <common.h>
+#include <bootretry.h>
+#include <cli.h>
 #include <command.h>
 #include <edid.h>
 #include <environment.h>
@@ -562,9 +564,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
        if (argc != 3)
                return CMD_RET_USAGE;
 
-#ifdef CONFIG_BOOT_RETRY_TIME
-       reset_cmd_timeout();    /* got a good command to get here */
-#endif
+       bootretry_reset_cmd_timeout();  /* got a good command to get here */
        /*
         * We use the last specified parameters, unless new ones are
         * entered.
@@ -612,7 +612,7 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
                                printf(" %08lx", data);
                }
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0) {
                        /*
                         * <CR> pressed as only input, don't modify current
@@ -621,9 +621,8 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
                        if (incrflag)
                                addr += size;
                        nbytes = size;
-#ifdef CONFIG_BOOT_RETRY_TIME
-                       reset_cmd_timeout(); /* good enough to not time out */
-#endif
+                       /* good enough to not time out */
+                       bootretry_reset_cmd_timeout();
                }
 #ifdef CONFIG_BOOT_RETRY_TIME
                else if (nbytes == -2)
@@ -640,12 +639,10 @@ mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
                        data = be32_to_cpu(data);
                        nbytes = endp - console_buffer;
                        if (nbytes) {
-#ifdef CONFIG_BOOT_RETRY_TIME
                                /*
                                 * good enough to not time out
                                 */
-                               reset_cmd_timeout();
-#endif
+                               bootretry_reset_cmd_timeout();
                                if (i2c_write(chip, addr, alen, (uchar *)&data, size) != 0)
                                        puts ("Error writing the chip.\n");
 #ifdef CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS
index 5b03c2d5b10b97777ef972a365262eae71fe0c9a..1febddb916c2fc6603ab890679782700923b88fa 100644 (file)
@@ -12,6 +12,8 @@
  */
 
 #include <common.h>
+#include <bootretry.h>
+#include <cli.h>
 #include <command.h>
 #ifdef CONFIG_HAS_DATAFLASH
 #include <dataflash.h>
@@ -1096,9 +1098,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
        if (argc != 2)
                return CMD_RET_USAGE;
 
-#ifdef CONFIG_BOOT_RETRY_TIME
-       reset_cmd_timeout();    /* got a good command to get here */
-#endif
+       bootretry_reset_cmd_timeout();  /* got a good command to get here */
        /* We use the last specified parameters, unless new ones are
         * entered.
         */
@@ -1149,7 +1149,7 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
                else
                        printf(" %02x", *((u8 *)ptr));
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
                        /* <CR> pressed as only input, don't modify current
                         * location and move to next. "-" pressed will go back.
@@ -1157,9 +1157,8 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
                        if (incrflag)
                                addr += nbytes ? -size : size;
                        nbytes = 1;
-#ifdef CONFIG_BOOT_RETRY_TIME
-                       reset_cmd_timeout(); /* good enough to not time out */
-#endif
+                       /* good enough to not time out */
+                       bootretry_reset_cmd_timeout();
                }
 #ifdef CONFIG_BOOT_RETRY_TIME
                else if (nbytes == -2) {
@@ -1175,11 +1174,9 @@ mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
 #endif
                        nbytes = endp - console_buffer;
                        if (nbytes) {
-#ifdef CONFIG_BOOT_RETRY_TIME
                                /* good enough to not time out
                                 */
-                               reset_cmd_timeout();
-#endif
+                               bootretry_reset_cmd_timeout();
                                if (size == 4)
                                        *((u32 *)ptr) = i;
 #ifdef CONFIG_SYS_SUPPORT_64BIT_DATA
index f4e306ceba9a3b67fa2319a6668ff35aa9410978..e6c33956e7b5c493b62128aa5ce6c06ff67bb38a 100644 (file)
@@ -25,6 +25,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <command.h>
 #include <environment.h>
 #include <search.h>
@@ -408,7 +409,7 @@ int do_env_ask(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                return 1;
 
        /* prompt for input */
-       len = readline(message);
+       len = cli_readline(message);
 
        if (size < len)
                console_buffer[size] = '\0';
@@ -591,7 +592,7 @@ static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
        else
                buffer[0] = '\0';
 
-       if (readline_into_buffer("edit: ", buffer, 0) < 0)
+       if (cli_readline_into_buffer("edit: ", buffer, 0) < 0)
                return 1;
 
        return setenv(argv[1], buffer);
index d3e7c089b00ab5f4b06d48a0fedd5746cd388cc7..a1ba42e2f3a2c3a4abc625af674a4599af451f38 100644 (file)
@@ -14,6 +14,8 @@
  */
 
 #include <common.h>
+#include <bootretry.h>
+#include <cli.h>
 #include <command.h>
 #include <asm/processor.h>
 #include <asm/io.h>
@@ -345,7 +347,7 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag
                        printf(" %02x", val1);
                }
 
-               nbytes = readline (" ? ");
+               nbytes = cli_readline(" ? ");
                if (nbytes == 0 || (nbytes == 1 && console_buffer[0] == '-')) {
                        /* <CR> pressed as only input, don't modify current
                         * location and move to next. "-" pressed will go back.
@@ -353,9 +355,8 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag
                        if (incrflag)
                                addr += nbytes ? -size : size;
                        nbytes = 1;
-#ifdef CONFIG_BOOT_RETRY_TIME
-                       reset_cmd_timeout(); /* good enough to not time out */
-#endif
+                       /* good enough to not time out */
+                       bootretry_reset_cmd_timeout();
                }
 #ifdef CONFIG_BOOT_RETRY_TIME
                else if (nbytes == -2) {
@@ -367,11 +368,9 @@ pci_cfg_modify (pci_dev_t bdf, ulong addr, ulong size, ulong value, int incrflag
                        i = simple_strtoul(console_buffer, &endp, 16);
                        nbytes = endp - console_buffer;
                        if (nbytes) {
-#ifdef CONFIG_BOOT_RETRY_TIME
                                /* good enough to not time out
                                 */
-                               reset_cmd_timeout();
-#endif
+                               bootretry_reset_cmd_timeout();
                                pci_cfg_write (bdf, addr, size, i);
                                if (incrflag)
                                        addr += size;
index fa4864d24c3001571153b0f84634843e59dfca04..26eb89a2b29b56875736f78acdaccae4c3ebf883 100644 (file)
@@ -139,6 +139,7 @@ static const table_entry_t uimage_type[] = {
        {       IH_TYPE_STANDALONE, "standalone", "Standalone Program", },
        {       IH_TYPE_UBLIMAGE,   "ublimage",   "Davinci UBL image",},
        {       IH_TYPE_MXSIMAGE,   "mxsimage",   "Freescale MXS Boot Image",},
+       {       IH_TYPE_ATMELIMAGE, "atmelimage", "ATMEL ROM-Boot Image",},
        {       -1,                 "",           "",                   },
 };
 
index 9bee7bdc6b0e9b8deeb21b15647ff48a8e88156d..32618f139f2e601ff804e3057d4a185f151694f5 100644 (file)
@@ -2,25 +2,15 @@
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * Add to readline cmdline-editing by
- * (C) Copyright 2005
- * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
- *
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
 /* #define     DEBUG   */
 
 #include <common.h>
-#include <command.h>
-#include <fdtdec.h>
-#include <hush.h>
-#include <malloc.h>
-#include <menu.h>
-#include <post.h>
+#include <autoboot.h>
+#include <cli.h>
 #include <version.h>
-#include <watchdog.h>
-#include <linux/ctype.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -30,400 +20,43 @@ DECLARE_GLOBAL_DATA_PTR;
 void inline __show_boot_progress (int val) {}
 void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
 
-#define MAX_DELAY_STOP_STR 32
-
-#define DEBUG_PARSER   0       /* set to 1 to debug */
-
-#define debug_parser(fmt, args...)             \
-       debug_cond(DEBUG_PARSER, fmt, ##args)
-
-#ifndef DEBUG_BOOTKEYS
-#define DEBUG_BOOTKEYS 0
-#endif
-#define debug_bootkeys(fmt, args...)           \
-       debug_cond(DEBUG_BOOTKEYS, fmt, ##args)
-
-char        console_buffer[CONFIG_SYS_CBSIZE + 1];     /* console I/O buffer   */
-
-static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen);
-static const char erase_seq[] = "\b \b";               /* erase sequence       */
-static const char   tab_seq[] = "        ";            /* used to expand TABs  */
-
-#ifdef CONFIG_BOOT_RETRY_TIME
-static uint64_t endtime = 0;  /* must be set, default is instant timeout */
-static int      retry_time = -1; /* -1 so can call readline before main_loop */
-#endif
-
-#define        endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk())
-
-#ifndef CONFIG_BOOT_RETRY_MIN
-#define CONFIG_BOOT_RETRY_MIN CONFIG_BOOT_RETRY_TIME
-#endif
-
-#ifdef CONFIG_MODEM_SUPPORT
-int do_mdm_init = 0;
-extern void mdm_init(void); /* defined in board.c */
-#endif
-
-/***************************************************************************
- * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
- * returns: 0 -  no key string, allow autoboot 1 - got key string, abort
- */
-#if defined(CONFIG_BOOTDELAY)
-# if defined(CONFIG_AUTOBOOT_KEYED)
-static int abortboot_keyed(int bootdelay)
-{
-       int abort = 0;
-       uint64_t etime = endtick(bootdelay);
-       struct {
-               char* str;
-               u_int len;
-               int retry;
-       }
-       delaykey [] = {
-               { str: getenv ("bootdelaykey"),  retry: 1 },
-               { str: getenv ("bootdelaykey2"), retry: 1 },
-               { str: getenv ("bootstopkey"),   retry: 0 },
-               { str: getenv ("bootstopkey2"),  retry: 0 },
-       };
-
-       char presskey [MAX_DELAY_STOP_STR];
-       u_int presskey_len = 0;
-       u_int presskey_max = 0;
-       u_int i;
-
-#ifndef CONFIG_ZERO_BOOTDELAY_CHECK
-       if (bootdelay == 0)
-               return 0;
-#endif
-
-#  ifdef CONFIG_AUTOBOOT_PROMPT
-       printf(CONFIG_AUTOBOOT_PROMPT);
-#  endif
-
-#  ifdef CONFIG_AUTOBOOT_DELAY_STR
-       if (delaykey[0].str == NULL)
-               delaykey[0].str = CONFIG_AUTOBOOT_DELAY_STR;
-#  endif
-#  ifdef CONFIG_AUTOBOOT_DELAY_STR2
-       if (delaykey[1].str == NULL)
-               delaykey[1].str = CONFIG_AUTOBOOT_DELAY_STR2;
-#  endif
-#  ifdef CONFIG_AUTOBOOT_STOP_STR
-       if (delaykey[2].str == NULL)
-               delaykey[2].str = CONFIG_AUTOBOOT_STOP_STR;
-#  endif
-#  ifdef CONFIG_AUTOBOOT_STOP_STR2
-       if (delaykey[3].str == NULL)
-               delaykey[3].str = CONFIG_AUTOBOOT_STOP_STR2;
-#  endif
-
-       for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
-               delaykey[i].len = delaykey[i].str == NULL ?
-                                   0 : strlen (delaykey[i].str);
-               delaykey[i].len = delaykey[i].len > MAX_DELAY_STOP_STR ?
-                                   MAX_DELAY_STOP_STR : delaykey[i].len;
-
-               presskey_max = presskey_max > delaykey[i].len ?
-                                   presskey_max : delaykey[i].len;
-
-               debug_bootkeys("%s key:<%s>\n",
-                              delaykey[i].retry ? "delay" : "stop",
-                              delaykey[i].str ? delaykey[i].str : "NULL");
-       }
-
-       /* In order to keep up with incoming data, check timeout only
-        * when catch up.
-        */
-       do {
-               if (tstc()) {
-                       if (presskey_len < presskey_max) {
-                               presskey [presskey_len ++] = getc();
-                       }
-                       else {
-                               for (i = 0; i < presskey_max - 1; i ++)
-                                       presskey [i] = presskey [i + 1];
-
-                               presskey [i] = getc();
-                       }
-               }
-
-               for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
-                       if (delaykey[i].len > 0 &&
-                           presskey_len >= delaykey[i].len &&
-                           memcmp (presskey + presskey_len - delaykey[i].len,
-                                   delaykey[i].str,
-                                   delaykey[i].len) == 0) {
-                               debug_bootkeys("got %skey\n",
-                                              delaykey[i].retry ? "delay" :
-                                              "stop");
-
-#  ifdef CONFIG_BOOT_RETRY_TIME
-                               /* don't retry auto boot */
-                               if (! delaykey[i].retry)
-                                       retry_time = -1;
-#  endif
-                               abort = 1;
-                       }
-               }
-       } while (!abort && get_ticks() <= etime);
-
-       if (!abort)
-               debug_bootkeys("key timeout\n");
-
-#ifdef CONFIG_SILENT_CONSOLE
-       if (abort)
-               gd->flags &= ~GD_FLG_SILENT;
-#endif
-
-       return abort;
-}
-
-# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
-
-#ifdef CONFIG_MENUKEY
-static int menukey = 0;
-#endif
-
-static int abortboot_normal(int bootdelay)
+static void modem_init(void)
 {
-       int abort = 0;
-       unsigned long ts;
-
-#ifdef CONFIG_MENUPROMPT
-       printf(CONFIG_MENUPROMPT);
-#else
-       if (bootdelay >= 0)
-               printf("Hit any key to stop autoboot: %2d ", bootdelay);
-#endif
-
-#if defined CONFIG_ZERO_BOOTDELAY_CHECK
-       /*
-        * Check if key already pressed
-        * Don't check if bootdelay < 0
-        */
-       if (bootdelay >= 0) {
-               if (tstc()) {   /* we got a key press   */
-                       (void) getc();  /* consume input        */
-                       puts ("\b\b\b 0");
-                       abort = 1;      /* don't auto boot      */
-               }
-       }
-#endif
-
-       while ((bootdelay > 0) && (!abort)) {
-               --bootdelay;
-               /* delay 1000 ms */
-               ts = get_timer(0);
-               do {
-                       if (tstc()) {   /* we got a key press   */
-                               abort  = 1;     /* don't auto boot      */
-                               bootdelay = 0;  /* no more delay        */
-# ifdef CONFIG_MENUKEY
-                               menukey = getc();
-# else
-                               (void) getc();  /* consume input        */
-# endif
-                               break;
-                       }
-                       udelay(10000);
-               } while (!abort && get_timer(ts) < 1000);
-
-               printf("\b\b\b%2d ", bootdelay);
-       }
-
-       putc('\n');
-
-#ifdef CONFIG_SILENT_CONSOLE
-       if (abort)
-               gd->flags &= ~GD_FLG_SILENT;
-#endif
-
-       return abort;
-}
-# endif        /* CONFIG_AUTOBOOT_KEYED */
-
-static int abortboot(int bootdelay)
-{
-#ifdef CONFIG_AUTOBOOT_KEYED
-       return abortboot_keyed(bootdelay);
-#else
-       return abortboot_normal(bootdelay);
-#endif
-}
-#endif /* CONFIG_BOOTDELAY */
-
-/*
- * Runs the given boot command securely.  Specifically:
- * - Doesn't run the command with the shell (run_command or parse_string_outer),
- *   since that's a lot of code surface that an attacker might exploit.
- *   Because of this, we don't do any argument parsing--the secure boot command
- *   has to be a full-fledged u-boot command.
- * - Doesn't check for keypresses before booting, since that could be a
- *   security hole; also disables Ctrl-C.
- * - Doesn't allow the command to return.
- *
- * Upon any failures, this function will drop into an infinite loop after
- * printing the error message to console.
- */
-
-#if defined(CONFIG_BOOTDELAY) && defined(CONFIG_OF_CONTROL)
-static void secure_boot_cmd(char *cmd)
-{
-       cmd_tbl_t *cmdtp;
-       int rc;
-
-       if (!cmd) {
-               printf("## Error: Secure boot command not specified\n");
-               goto err;
-       }
-
-       /* Disable Ctrl-C just in case some command is used that checks it. */
-       disable_ctrlc(1);
+#ifdef CONFIG_MODEM_SUPPORT
+       debug("DEBUG: main_loop:   gd->do_mdm_init=%lu\n", gd->do_mdm_init);
+       if (gd->do_mdm_init) {
+               char *str = getenv("mdm_cmd");
 
-       /* Find the command directly. */
-       cmdtp = find_cmd(cmd);
-       if (!cmdtp) {
-               printf("## Error: \"%s\" not defined\n", cmd);
-               goto err;
+               setenv("preboot", str);  /* set or delete definition */
+               mdm_init(); /* wait for modem connection */
        }
-
-       /* Run the command, forcing no flags and faking argc and argv. */
-       rc = (cmdtp->cmd)(cmdtp, 0, 1, &cmd);
-
-       /* Shouldn't ever return from boot command. */
-       printf("## Error: \"%s\" returned (code %d)\n", cmd, rc);
-
-err:
-       /*
-        * Not a whole lot to do here.  Rebooting won't help much, since we'll
-        * just end up right back here.  Just loop.
-        */
-       hang();
-}
-
-static void process_fdt_options(const void *blob)
-{
-       ulong addr;
-
-       /* Add an env variable to point to a kernel payload, if available */
-       addr = fdtdec_get_config_int(gd->fdt_blob, "kernel-offset", 0);
-       if (addr)
-               setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
-
-       /* Add an env variable to point to a root disk, if available */
-       addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
-       if (addr)
-               setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+#endif  /* CONFIG_MODEM_SUPPORT */
 }
-#endif /* CONFIG_OF_CONTROL */
 
-#ifdef CONFIG_BOOTDELAY
-static void process_boot_delay(void)
+static void run_preboot_environment_command(void)
 {
-#ifdef CONFIG_OF_CONTROL
-       char *env;
-#endif
-       char *s;
-       int bootdelay;
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-       unsigned long bootcount = 0;
-       unsigned long bootlimit = 0;
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-       bootcount = bootcount_load();
-       bootcount++;
-       bootcount_store (bootcount);
-       setenv_ulong("bootcount", bootcount);
-       bootlimit = getenv_ulong("bootlimit", 10, 0);
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
-
-       s = getenv ("bootdelay");
-       bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
-
-#ifdef CONFIG_OF_CONTROL
-       bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
-                       bootdelay);
-#endif
-
-       debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
-
-#if defined(CONFIG_MENU_SHOW)
-       bootdelay = menu_show(bootdelay);
-#endif
-# ifdef CONFIG_BOOT_RETRY_TIME
-       init_cmd_timeout ();
-# endif        /* CONFIG_BOOT_RETRY_TIME */
-
-#ifdef CONFIG_POST
-       if (gd->flags & GD_FLG_POSTFAIL) {
-               s = getenv("failbootcmd");
-       }
-       else
-#endif /* CONFIG_POST */
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-       if (bootlimit && (bootcount > bootlimit)) {
-               printf ("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
-                       (unsigned)bootlimit);
-               s = getenv ("altbootcmd");
-       }
-       else
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
-               s = getenv ("bootcmd");
-#ifdef CONFIG_OF_CONTROL
-       /* Allow the fdt to override the boot command */
-       env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
-       if (env)
-               s = env;
-
-       process_fdt_options(gd->fdt_blob);
-
-       /*
-        * If the bootsecure option was chosen, use secure_boot_cmd().
-        * Always use 'env' in this case, since bootsecure requres that the
-        * bootcmd was specified in the FDT too.
-        */
-       if (fdtdec_get_config_int(gd->fdt_blob, "bootsecure", 0))
-               secure_boot_cmd(env);
-
-#endif /* CONFIG_OF_CONTROL */
-
-       debug ("### main_loop: bootcmd=\"%s\"\n", s ? s : "<UNDEFINED>");
+#ifdef CONFIG_PREBOOT
+       char *p;
 
-       if (bootdelay != -1 && s && !abortboot(bootdelay)) {
-#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
+       p = getenv("preboot");
+       if (p != NULL) {
+# ifdef CONFIG_AUTOBOOT_KEYED
                int prev = disable_ctrlc(1);    /* disable Control C checking */
-#endif
+# endif
 
-               run_command_list(s, -1, 0);
+               run_command_list(p, -1, 0);
 
-#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
+# ifdef CONFIG_AUTOBOOT_KEYED
                disable_ctrlc(prev);    /* restore Control C checking */
-#endif
-       }
-
-#ifdef CONFIG_MENUKEY
-       if (menukey == CONFIG_MENUKEY) {
-               s = getenv("menucmd");
-               if (s)
-                       run_command_list(s, -1, 0);
+# endif
        }
-#endif /* CONFIG_MENUKEY */
+#endif /* CONFIG_PREBOOT */
 }
-#endif /* CONFIG_BOOTDELAY */
 
+/* We come here after U-Boot is initialised and ready to process commands */
 void main_loop(void)
 {
-#ifndef CONFIG_SYS_HUSH_PARSER
-       static char lastcommand[CONFIG_SYS_CBSIZE] = { 0, };
-       int len;
-       int rc = 1;
-       int flag;
-#endif
-#ifdef CONFIG_PREBOOT
-       char *p;
-#endif
+       const char *s;
 
        bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
 
@@ -433,1126 +66,24 @@ void main_loop(void)
        puts("upgraded by the late 2014 may break or be removed.\n");
 #endif
 
-#ifdef CONFIG_MODEM_SUPPORT
-       debug("DEBUG: main_loop:   do_mdm_init=%d\n", do_mdm_init);
-       if (do_mdm_init) {
-               char *str = strdup(getenv("mdm_cmd"));
-               setenv("preboot", str);  /* set or delete definition */
-               if (str != NULL)
-                       free(str);
-               mdm_init(); /* wait for modem connection */
-       }
-#endif  /* CONFIG_MODEM_SUPPORT */
-
+       modem_init();
 #ifdef CONFIG_VERSION_VARIABLE
-       {
-               setenv("ver", version_string);  /* set version variable */
-       }
+       setenv("ver", version_string);  /* set version variable */
 #endif /* CONFIG_VERSION_VARIABLE */
 
-#ifdef CONFIG_SYS_HUSH_PARSER
-       u_boot_hush_start();
-#endif
-
-#if defined(CONFIG_HUSH_INIT_VAR)
-       hush_init_var();
-#endif
-
-#ifdef CONFIG_PREBOOT
-       p = getenv("preboot");
-       if (p != NULL) {
-# ifdef CONFIG_AUTOBOOT_KEYED
-               int prev = disable_ctrlc(1);    /* disable Control C checking */
-# endif
+       cli_init();
 
-               run_command_list(p, -1, 0);
-
-# ifdef CONFIG_AUTOBOOT_KEYED
-               disable_ctrlc(prev);    /* restore Control C checking */
-# endif
-       }
-#endif /* CONFIG_PREBOOT */
+       run_preboot_environment_command();
 
 #if defined(CONFIG_UPDATE_TFTP)
        update_tftp(0UL);
 #endif /* CONFIG_UPDATE_TFTP */
 
-#ifdef CONFIG_BOOTDELAY
-       process_boot_delay();
-#endif
-       /*
-        * Main Loop for Monitor Command Processing
-        */
-#ifdef CONFIG_SYS_HUSH_PARSER
-       parse_file_outer();
-       /* This point is never reached */
-       for (;;);
-#else
-       for (;;) {
-#ifdef CONFIG_BOOT_RETRY_TIME
-               if (rc >= 0) {
-                       /* Saw enough of a valid command to
-                        * restart the timeout.
-                        */
-                       reset_cmd_timeout();
-               }
-#endif
-               len = readline (CONFIG_SYS_PROMPT);
-
-               flag = 0;       /* assume no special flags for now */
-               if (len > 0)
-                       strcpy (lastcommand, console_buffer);
-               else if (len == 0)
-                       flag |= CMD_FLAG_REPEAT;
-#ifdef CONFIG_BOOT_RETRY_TIME
-               else if (len == -2) {
-                       /* -2 means timed out, retry autoboot
-                        */
-                       puts ("\nTimed out waiting for command\n");
-# ifdef CONFIG_RESET_TO_RETRY
-                       /* Reinit board to run initialization code again */
-                       do_reset (NULL, 0, 0, NULL);
-# else
-                       return;         /* retry autoboot */
-# endif
-               }
-#endif
-
-               if (len == -1)
-                       puts ("<INTERRUPT>\n");
-               else
-                       rc = run_command(lastcommand, flag);
-
-               if (rc <= 0) {
-                       /* invalid command or not repeatable, forget it */
-                       lastcommand[0] = 0;
-               }
-       }
-#endif /*CONFIG_SYS_HUSH_PARSER*/
-}
-
-#ifdef CONFIG_BOOT_RETRY_TIME
-/***************************************************************************
- * initialize command line timeout
- */
-void init_cmd_timeout(void)
-{
-       char *s = getenv ("bootretry");
-
-       if (s != NULL)
-               retry_time = (int)simple_strtol(s, NULL, 10);
-       else
-               retry_time =  CONFIG_BOOT_RETRY_TIME;
-
-       if (retry_time >= 0 && retry_time < CONFIG_BOOT_RETRY_MIN)
-               retry_time = CONFIG_BOOT_RETRY_MIN;
-}
-
-/***************************************************************************
- * reset command line timeout to retry_time seconds
- */
-void reset_cmd_timeout(void)
-{
-       endtime = endtick(retry_time);
-}
-#endif
-
-#ifdef CONFIG_CMDLINE_EDITING
-
-/*
- * cmdline-editing related codes from vivi.
- * Author: Janghoon Lyu <nandy@mizi.com>
- */
-
-#define putnstr(str,n) do {                    \
-               printf ("%.*s", (int)n, str);   \
-       } while (0)
-
-#define CTL_CH(c)              ((c) - 'a' + 1)
-#define CTL_BACKSPACE          ('\b')
-#define DEL                    ((char)255)
-#define DEL7                   ((char)127)
-#define CREAD_HIST_CHAR                ('!')
-
-#define getcmd_putch(ch)       putc(ch)
-#define getcmd_getch()         getc()
-#define getcmd_cbeep()         getcmd_putch('\a')
-
-#define HIST_MAX               20
-#define HIST_SIZE              CONFIG_SYS_CBSIZE
-
-static int hist_max;
-static int hist_add_idx;
-static int hist_cur = -1;
-static unsigned hist_num;
-
-static char *hist_list[HIST_MAX];
-static char hist_lines[HIST_MAX][HIST_SIZE + 1];       /* Save room for NULL */
-
-#define add_idx_minus_one() ((hist_add_idx == 0) ? hist_max : hist_add_idx-1)
-
-static void hist_init(void)
-{
-       int i;
-
-       hist_max = 0;
-       hist_add_idx = 0;
-       hist_cur = -1;
-       hist_num = 0;
-
-       for (i = 0; i < HIST_MAX; i++) {
-               hist_list[i] = hist_lines[i];
-               hist_list[i][0] = '\0';
-       }
-}
-
-static void cread_add_to_hist(char *line)
-{
-       strcpy(hist_list[hist_add_idx], line);
-
-       if (++hist_add_idx >= HIST_MAX)
-               hist_add_idx = 0;
-
-       if (hist_add_idx > hist_max)
-               hist_max = hist_add_idx;
-
-       hist_num++;
-}
-
-static char* hist_prev(void)
-{
-       char *ret;
-       int old_cur;
-
-       if (hist_cur < 0)
-               return NULL;
-
-       old_cur = hist_cur;
-       if (--hist_cur < 0)
-               hist_cur = hist_max;
-
-       if (hist_cur == hist_add_idx) {
-               hist_cur = old_cur;
-               ret = NULL;
-       } else
-               ret = hist_list[hist_cur];
-
-       return (ret);
-}
-
-static char* hist_next(void)
-{
-       char *ret;
-
-       if (hist_cur < 0)
-               return NULL;
-
-       if (hist_cur == hist_add_idx)
-               return NULL;
-
-       if (++hist_cur > hist_max)
-               hist_cur = 0;
-
-       if (hist_cur == hist_add_idx) {
-               ret = "";
-       } else
-               ret = hist_list[hist_cur];
-
-       return (ret);
-}
-
-#ifndef CONFIG_CMDLINE_EDITING
-static void cread_print_hist_list(void)
-{
-       int i;
-       unsigned long n;
-
-       n = hist_num - hist_max;
-
-       i = hist_add_idx + 1;
-       while (1) {
-               if (i > hist_max)
-                       i = 0;
-               if (i == hist_add_idx)
-                       break;
-               printf("%s\n", hist_list[i]);
-               n++;
-               i++;
-       }
-}
-#endif /* CONFIG_CMDLINE_EDITING */
-
-#define BEGINNING_OF_LINE() {                  \
-       while (num) {                           \
-               getcmd_putch(CTL_BACKSPACE);    \
-               num--;                          \
-       }                                       \
-}
-
-#define ERASE_TO_EOL() {                               \
-       if (num < eol_num) {                            \
-               printf("%*s", (int)(eol_num - num), ""); \
-               do {                                    \
-                       getcmd_putch(CTL_BACKSPACE);    \
-               } while (--eol_num > num);              \
-       }                                               \
-}
-
-#define REFRESH_TO_EOL() {                     \
-       if (num < eol_num) {                    \
-               wlen = eol_num - num;           \
-               putnstr(buf + num, wlen);       \
-               num = eol_num;                  \
-       }                                       \
-}
-
-static void cread_add_char(char ichar, int insert, unsigned long *num,
-              unsigned long *eol_num, char *buf, unsigned long len)
-{
-       unsigned long wlen;
-
-       /* room ??? */
-       if (insert || *num == *eol_num) {
-               if (*eol_num > len - 1) {
-                       getcmd_cbeep();
-                       return;
-               }
-               (*eol_num)++;
-       }
-
-       if (insert) {
-               wlen = *eol_num - *num;
-               if (wlen > 1) {
-                       memmove(&buf[*num+1], &buf[*num], wlen-1);
-               }
+       s = bootdelay_process();
+       if (cli_process_fdt(&s))
+               cli_secure_boot_cmd(s);
 
-               buf[*num] = ichar;
-               putnstr(buf + *num, wlen);
-               (*num)++;
-               while (--wlen) {
-                       getcmd_putch(CTL_BACKSPACE);
-               }
-       } else {
-               /* echo the character */
-               wlen = 1;
-               buf[*num] = ichar;
-               putnstr(buf + *num, wlen);
-               (*num)++;
-       }
-}
+       autoboot_command(s);
 
-static void cread_add_str(char *str, int strsize, int insert, unsigned long *num,
-             unsigned long *eol_num, char *buf, unsigned long len)
-{
-       while (strsize--) {
-               cread_add_char(*str, insert, num, eol_num, buf, len);
-               str++;
-       }
+       cli_loop();
 }
-
-static int cread_line(const char *const prompt, char *buf, unsigned int *len,
-               int timeout)
-{
-       unsigned long num = 0;
-       unsigned long eol_num = 0;
-       unsigned long wlen;
-       char ichar;
-       int insert = 1;
-       int esc_len = 0;
-       char esc_save[8];
-       int init_len = strlen(buf);
-       int first = 1;
-
-       if (init_len)
-               cread_add_str(buf, init_len, 1, &num, &eol_num, buf, *len);
-
-       while (1) {
-#ifdef CONFIG_BOOT_RETRY_TIME
-               while (!tstc()) {       /* while no incoming data */
-                       if (retry_time >= 0 && get_ticks() > endtime)
-                               return (-2);    /* timed out */
-                       WATCHDOG_RESET();
-               }
-#endif
-               if (first && timeout) {
-                       uint64_t etime = endtick(timeout);
-
-                       while (!tstc()) {       /* while no incoming data */
-                               if (get_ticks() >= etime)
-                                       return -2;      /* timed out */
-                               WATCHDOG_RESET();
-                       }
-                       first = 0;
-               }
-
-               ichar = getcmd_getch();
-
-               if ((ichar == '\n') || (ichar == '\r')) {
-                       putc('\n');
-                       break;
-               }
-
-               /*
-                * handle standard linux xterm esc sequences for arrow key, etc.
-                */
-               if (esc_len != 0) {
-                       if (esc_len == 1) {
-                               if (ichar == '[') {
-                                       esc_save[esc_len] = ichar;
-                                       esc_len = 2;
-                               } else {
-                                       cread_add_str(esc_save, esc_len, insert,
-                                                     &num, &eol_num, buf, *len);
-                                       esc_len = 0;
-                               }
-                               continue;
-                       }
-
-                       switch (ichar) {
-
-                       case 'D':       /* <- key */
-                               ichar = CTL_CH('b');
-                               esc_len = 0;
-                               break;
-                       case 'C':       /* -> key */
-                               ichar = CTL_CH('f');
-                               esc_len = 0;
-                               break;  /* pass off to ^F handler */
-                       case 'H':       /* Home key */
-                               ichar = CTL_CH('a');
-                               esc_len = 0;
-                               break;  /* pass off to ^A handler */
-                       case 'A':       /* up arrow */
-                               ichar = CTL_CH('p');
-                               esc_len = 0;
-                               break;  /* pass off to ^P handler */
-                       case 'B':       /* down arrow */
-                               ichar = CTL_CH('n');
-                               esc_len = 0;
-                               break;  /* pass off to ^N handler */
-                       default:
-                               esc_save[esc_len++] = ichar;
-                               cread_add_str(esc_save, esc_len, insert,
-                                             &num, &eol_num, buf, *len);
-                               esc_len = 0;
-                               continue;
-                       }
-               }
-
-               switch (ichar) {
-               case 0x1b:
-                       if (esc_len == 0) {
-                               esc_save[esc_len] = ichar;
-                               esc_len = 1;
-                       } else {
-                               puts("impossible condition #876\n");
-                               esc_len = 0;
-                       }
-                       break;
-
-               case CTL_CH('a'):
-                       BEGINNING_OF_LINE();
-                       break;
-               case CTL_CH('c'):       /* ^C - break */
-                       *buf = '\0';    /* discard input */
-                       return (-1);
-               case CTL_CH('f'):
-                       if (num < eol_num) {
-                               getcmd_putch(buf[num]);
-                               num++;
-                       }
-                       break;
-               case CTL_CH('b'):
-                       if (num) {
-                               getcmd_putch(CTL_BACKSPACE);
-                               num--;
-                       }
-                       break;
-               case CTL_CH('d'):
-                       if (num < eol_num) {
-                               wlen = eol_num - num - 1;
-                               if (wlen) {
-                                       memmove(&buf[num], &buf[num+1], wlen);
-                                       putnstr(buf + num, wlen);
-                               }
-
-                               getcmd_putch(' ');
-                               do {
-                                       getcmd_putch(CTL_BACKSPACE);
-                               } while (wlen--);
-                               eol_num--;
-                       }
-                       break;
-               case CTL_CH('k'):
-                       ERASE_TO_EOL();
-                       break;
-               case CTL_CH('e'):
-                       REFRESH_TO_EOL();
-                       break;
-               case CTL_CH('o'):
-                       insert = !insert;
-                       break;
-               case CTL_CH('x'):
-               case CTL_CH('u'):
-                       BEGINNING_OF_LINE();
-                       ERASE_TO_EOL();
-                       break;
-               case DEL:
-               case DEL7:
-               case 8:
-                       if (num) {
-                               wlen = eol_num - num;
-                               num--;
-                               memmove(&buf[num], &buf[num+1], wlen);
-                               getcmd_putch(CTL_BACKSPACE);
-                               putnstr(buf + num, wlen);
-                               getcmd_putch(' ');
-                               do {
-                                       getcmd_putch(CTL_BACKSPACE);
-                               } while (wlen--);
-                               eol_num--;
-                       }
-                       break;
-               case CTL_CH('p'):
-               case CTL_CH('n'):
-               {
-                       char * hline;
-
-                       esc_len = 0;
-
-                       if (ichar == CTL_CH('p'))
-                               hline = hist_prev();
-                       else
-                               hline = hist_next();
-
-                       if (!hline) {
-                               getcmd_cbeep();
-                               continue;
-                       }
-
-                       /* nuke the current line */
-                       /* first, go home */
-                       BEGINNING_OF_LINE();
-
-                       /* erase to end of line */
-                       ERASE_TO_EOL();
-
-                       /* copy new line into place and display */
-                       strcpy(buf, hline);
-                       eol_num = strlen(buf);
-                       REFRESH_TO_EOL();
-                       continue;
-               }
-#ifdef CONFIG_AUTO_COMPLETE
-               case '\t': {
-                       int num2, col;
-
-                       /* do not autocomplete when in the middle */
-                       if (num < eol_num) {
-                               getcmd_cbeep();
-                               break;
-                       }
-
-                       buf[num] = '\0';
-                       col = strlen(prompt) + eol_num;
-                       num2 = num;
-                       if (cmd_auto_complete(prompt, buf, &num2, &col)) {
-                               col = num2 - num;
-                               num += col;
-                               eol_num += col;
-                       }
-                       break;
-               }
-#endif
-               default:
-                       cread_add_char(ichar, insert, &num, &eol_num, buf, *len);
-                       break;
-               }
-       }
-       *len = eol_num;
-       buf[eol_num] = '\0';    /* lose the newline */
-
-       if (buf[0] && buf[0] != CREAD_HIST_CHAR)
-               cread_add_to_hist(buf);
-       hist_cur = hist_add_idx;
-
-       return 0;
-}
-
-#endif /* CONFIG_CMDLINE_EDITING */
-
-/****************************************************************************/
-
-/*
- * Prompt for input and read a line.
- * If  CONFIG_BOOT_RETRY_TIME is defined and retry_time >= 0,
- * time out when time goes past endtime (timebase time in ticks).
- * Return:     number of read characters
- *             -1 if break
- *             -2 if timed out
- */
-int readline (const char *const prompt)
-{
-       /*
-        * If console_buffer isn't 0-length the user will be prompted to modify
-        * it instead of entering it from scratch as desired.
-        */
-       console_buffer[0] = '\0';
-
-       return readline_into_buffer(prompt, console_buffer, 0);
-}
-
-
-int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
-{
-       char *p = buffer;
-#ifdef CONFIG_CMDLINE_EDITING
-       unsigned int len = CONFIG_SYS_CBSIZE;
-       int rc;
-       static int initted = 0;
-
-       /*
-        * History uses a global array which is not
-        * writable until after relocation to RAM.
-        * Revert to non-history version if still
-        * running from flash.
-        */
-       if (gd->flags & GD_FLG_RELOC) {
-               if (!initted) {
-                       hist_init();
-                       initted = 1;
-               }
-
-               if (prompt)
-                       puts (prompt);
-
-               rc = cread_line(prompt, p, &len, timeout);
-               return rc < 0 ? rc : len;
-
-       } else {
-#endif /* CONFIG_CMDLINE_EDITING */
-       char * p_buf = p;
-       int     n = 0;                          /* buffer index         */
-       int     plen = 0;                       /* prompt length        */
-       int     col;                            /* output column cnt    */
-       char    c;
-
-       /* print prompt */
-       if (prompt) {
-               plen = strlen (prompt);
-               puts (prompt);
-       }
-       col = plen;
-
-       for (;;) {
-#ifdef CONFIG_BOOT_RETRY_TIME
-               while (!tstc()) {       /* while no incoming data */
-                       if (retry_time >= 0 && get_ticks() > endtime)
-                               return (-2);    /* timed out */
-                       WATCHDOG_RESET();
-               }
-#endif
-               WATCHDOG_RESET();               /* Trigger watchdog, if needed */
-
-#ifdef CONFIG_SHOW_ACTIVITY
-               while (!tstc()) {
-                       show_activity(0);
-                       WATCHDOG_RESET();
-               }
-#endif
-               c = getc();
-
-               /*
-                * Special character handling
-                */
-               switch (c) {
-               case '\r':                      /* Enter                */
-               case '\n':
-                       *p = '\0';
-                       puts ("\r\n");
-                       return p - p_buf;
-
-               case '\0':                      /* nul                  */
-                       continue;
-
-               case 0x03:                      /* ^C - break           */
-                       p_buf[0] = '\0';        /* discard input */
-                       return -1;
-
-               case 0x15:                      /* ^U - erase line      */
-                       while (col > plen) {
-                               puts (erase_seq);
-                               --col;
-                       }
-                       p = p_buf;
-                       n = 0;
-                       continue;
-
-               case 0x17:                      /* ^W - erase word      */
-                       p=delete_char(p_buf, p, &col, &n, plen);
-                       while ((n > 0) && (*p != ' ')) {
-                               p=delete_char(p_buf, p, &col, &n, plen);
-                       }
-                       continue;
-
-               case 0x08:                      /* ^H  - backspace      */
-               case 0x7F:                      /* DEL - backspace      */
-                       p=delete_char(p_buf, p, &col, &n, plen);
-                       continue;
-
-               default:
-                       /*
-                        * Must be a normal character then
-                        */
-                       if (n < CONFIG_SYS_CBSIZE-2) {
-                               if (c == '\t') {        /* expand TABs */
-#ifdef CONFIG_AUTO_COMPLETE
-                                       /* if auto completion triggered just continue */
-                                       *p = '\0';
-                                       if (cmd_auto_complete(prompt, console_buffer, &n, &col)) {
-                                               p = p_buf + n;  /* reset */
-                                               continue;
-                                       }
-#endif
-                                       puts (tab_seq+(col&07));
-                                       col += 8 - (col&07);
-                               } else {
-                                       char buf[2];
-
-                                       /*
-                                        * Echo input using puts() to force an
-                                        * LCD flush if we are using an LCD
-                                        */
-                                       ++col;
-                                       buf[0] = c;
-                                       buf[1] = '\0';
-                                       puts(buf);
-                               }
-                               *p++ = c;
-                               ++n;
-                       } else {                        /* Buffer full          */
-                               putc ('\a');
-                       }
-               }
-       }
-#ifdef CONFIG_CMDLINE_EDITING
-       }
-#endif
-}
-
-/****************************************************************************/
-
-static char * delete_char (char *buffer, char *p, int *colp, int *np, int plen)
-{
-       char *s;
-
-       if (*np == 0) {
-               return (p);
-       }
-
-       if (*(--p) == '\t') {                   /* will retype the whole line   */
-               while (*colp > plen) {
-                       puts (erase_seq);
-                       (*colp)--;
-               }
-               for (s=buffer; s<p; ++s) {
-                       if (*s == '\t') {
-                               puts (tab_seq+((*colp) & 07));
-                               *colp += 8 - ((*colp) & 07);
-                       } else {
-                               ++(*colp);
-                               putc (*s);
-                       }
-               }
-       } else {
-               puts (erase_seq);
-               (*colp)--;
-       }
-       (*np)--;
-       return (p);
-}
-
-/****************************************************************************/
-
-int parse_line (char *line, char *argv[])
-{
-       int nargs = 0;
-
-       debug_parser("parse_line: \"%s\"\n", line);
-       while (nargs < CONFIG_SYS_MAXARGS) {
-
-               /* skip any white space */
-               while (isblank(*line))
-                       ++line;
-
-               if (*line == '\0') {    /* end of line, no more args    */
-                       argv[nargs] = NULL;
-                       debug_parser("parse_line: nargs=%d\n", nargs);
-                       return nargs;
-               }
-
-               argv[nargs++] = line;   /* begin of argument string     */
-
-               /* find end of string */
-               while (*line && !isblank(*line))
-                       ++line;
-
-               if (*line == '\0') {    /* end of line, no more args    */
-                       argv[nargs] = NULL;
-                       debug_parser("parse_line: nargs=%d\n", nargs);
-                       return nargs;
-               }
-
-               *line++ = '\0';         /* terminate current arg         */
-       }
-
-       printf ("** Too many args (max. %d) **\n", CONFIG_SYS_MAXARGS);
-
-       debug_parser("parse_line: nargs=%d\n", nargs);
-       return (nargs);
-}
-
-/****************************************************************************/
-
-#ifndef CONFIG_SYS_HUSH_PARSER
-static void process_macros (const char *input, char *output)
-{
-       char c, prev;
-       const char *varname_start = NULL;
-       int inputcnt = strlen (input);
-       int outputcnt = CONFIG_SYS_CBSIZE;
-       int state = 0;          /* 0 = waiting for '$'  */
-
-       /* 1 = waiting for '(' or '{' */
-       /* 2 = waiting for ')' or '}' */
-       /* 3 = waiting for '''  */
-       char *output_start = output;
-
-       debug_parser("[PROCESS_MACROS] INPUT len %zd: \"%s\"\n", strlen(input),
-                    input);
-
-       prev = '\0';            /* previous character   */
-
-       while (inputcnt && outputcnt) {
-               c = *input++;
-               inputcnt--;
-
-               if (state != 3) {
-                       /* remove one level of escape characters */
-                       if ((c == '\\') && (prev != '\\')) {
-                               if (inputcnt-- == 0)
-                                       break;
-                               prev = c;
-                               c = *input++;
-                       }
-               }
-
-               switch (state) {
-               case 0: /* Waiting for (unescaped) $    */
-                       if ((c == '\'') && (prev != '\\')) {
-                               state = 3;
-                               break;
-                       }
-                       if ((c == '$') && (prev != '\\')) {
-                               state++;
-                       } else {
-                               *(output++) = c;
-                               outputcnt--;
-                       }
-                       break;
-               case 1: /* Waiting for (        */
-                       if (c == '(' || c == '{') {
-                               state++;
-                               varname_start = input;
-                       } else {
-                               state = 0;
-                               *(output++) = '$';
-                               outputcnt--;
-
-                               if (outputcnt) {
-                                       *(output++) = c;
-                                       outputcnt--;
-                               }
-                       }
-                       break;
-               case 2: /* Waiting for )        */
-                       if (c == ')' || c == '}') {
-                               int i;
-                               char envname[CONFIG_SYS_CBSIZE], *envval;
-                               int envcnt = input - varname_start - 1; /* Varname # of chars */
-
-                               /* Get the varname */
-                               for (i = 0; i < envcnt; i++) {
-                                       envname[i] = varname_start[i];
-                               }
-                               envname[i] = 0;
-
-                               /* Get its value */
-                               envval = getenv (envname);
-
-                               /* Copy into the line if it exists */
-                               if (envval != NULL)
-                                       while ((*envval) && outputcnt) {
-                                               *(output++) = *(envval++);
-                                               outputcnt--;
-                                       }
-                               /* Look for another '$' */
-                               state = 0;
-                       }
-                       break;
-               case 3: /* Waiting for '        */
-                       if ((c == '\'') && (prev != '\\')) {
-                               state = 0;
-                       } else {
-                               *(output++) = c;
-                               outputcnt--;
-                       }
-                       break;
-               }
-               prev = c;
-       }
-
-       if (outputcnt)
-               *output = 0;
-       else
-               *(output - 1) = 0;
-
-       debug_parser("[PROCESS_MACROS] OUTPUT len %zd: \"%s\"\n",
-                    strlen(output_start), output_start);
-}
-
-/****************************************************************************
- * returns:
- *     1  - command executed, repeatable
- *     0  - command executed but not repeatable, interrupted commands are
- *          always considered not repeatable
- *     -1 - not executed (unrecognized, bootd recursion or too many args)
- *           (If cmd is NULL or "" or longer than CONFIG_SYS_CBSIZE-1 it is
- *           considered unrecognized)
- *
- * WARNING:
- *
- * We must create a temporary copy of the command since the command we get
- * may be the result from getenv(), which returns a pointer directly to
- * the environment data, which may change magicly when the command we run
- * creates or modifies environment variables (like "bootp" does).
- */
-static int builtin_run_command(const char *cmd, int flag)
-{
-       char cmdbuf[CONFIG_SYS_CBSIZE]; /* working copy of cmd          */
-       char *token;                    /* start of token in cmdbuf     */
-       char *sep;                      /* end of token (separator) in cmdbuf */
-       char finaltoken[CONFIG_SYS_CBSIZE];
-       char *str = cmdbuf;
-       char *argv[CONFIG_SYS_MAXARGS + 1];     /* NULL terminated      */
-       int argc, inquotes;
-       int repeatable = 1;
-       int rc = 0;
-
-       debug_parser("[RUN_COMMAND] cmd[%p]=\"", cmd);
-       if (DEBUG_PARSER) {
-               /* use puts - string may be loooong */
-               puts(cmd ? cmd : "NULL");
-               puts("\"\n");
-       }
-       clear_ctrlc();          /* forget any previous Control C */
-
-       if (!cmd || !*cmd) {
-               return -1;      /* empty command */
-       }
-
-       if (strlen(cmd) >= CONFIG_SYS_CBSIZE) {
-               puts ("## Command too long!\n");
-               return -1;
-       }
-
-       strcpy (cmdbuf, cmd);
-
-       /* Process separators and check for invalid
-        * repeatable commands
-        */
-
-       debug_parser("[PROCESS_SEPARATORS] %s\n", cmd);
-       while (*str) {
-
-               /*
-                * Find separator, or string end
-                * Allow simple escape of ';' by writing "\;"
-                */
-               for (inquotes = 0, sep = str; *sep; sep++) {
-                       if ((*sep=='\'') &&
-                           (*(sep-1) != '\\'))
-                               inquotes=!inquotes;
-
-                       if (!inquotes &&
-                           (*sep == ';') &&    /* separator            */
-                           ( sep != str) &&    /* past string start    */
-                           (*(sep-1) != '\\')) /* and NOT escaped      */
-                               break;
-               }
-
-               /*
-                * Limit the token to data between separators
-                */
-               token = str;
-               if (*sep) {
-                       str = sep + 1;  /* start of command for next pass */
-                       *sep = '\0';
-               }
-               else
-                       str = sep;      /* no more commands for next pass */
-               debug_parser("token: \"%s\"\n", token);
-
-               /* find macros in this token and replace them */
-               process_macros (token, finaltoken);
-
-               /* Extract arguments */
-               if ((argc = parse_line (finaltoken, argv)) == 0) {
-                       rc = -1;        /* no command at all */
-                       continue;
-               }
-
-               if (cmd_process(flag, argc, argv, &repeatable, NULL))
-                       rc = -1;
-
-               /* Did the user stop this? */
-               if (had_ctrlc ())
-                       return -1;      /* if stopped then not repeatable */
-       }
-
-       return rc ? rc : repeatable;
-}
-#endif
-
-/*
- * Run a command using the selected parser.
- *
- * @param cmd  Command to run
- * @param flag Execution flags (CMD_FLAG_...)
- * @return 0 on success, or != 0 on error.
- */
-int run_command(const char *cmd, int flag)
-{
-#ifndef CONFIG_SYS_HUSH_PARSER
-       /*
-        * builtin_run_command can return 0 or 1 for success, so clean up
-        * its result.
-        */
-       if (builtin_run_command(cmd, flag) == -1)
-               return 1;
-
-       return 0;
-#else
-       return parse_string_outer(cmd,
-                       FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP);
-#endif
-}
-
-#ifndef CONFIG_SYS_HUSH_PARSER
-/**
- * Execute a list of command separated by ; or \n using the built-in parser.
- *
- * This function cannot take a const char * for the command, since if it
- * finds newlines in the string, it replaces them with \0.
- *
- * @param cmd  String containing list of commands
- * @param flag Execution flags (CMD_FLAG_...)
- * @return 0 on success, or != 0 on error.
- */
-static int builtin_run_command_list(char *cmd, int flag)
-{
-       char *line, *next;
-       int rcode = 0;
-
-       /*
-        * Break into individual lines, and execute each line; terminate on
-        * error.
-        */
-       line = next = cmd;
-       while (*next) {
-               if (*next == '\n') {
-                       *next = '\0';
-                       /* run only non-empty commands */
-                       if (*line) {
-                               debug("** exec: \"%s\"\n", line);
-                               if (builtin_run_command(line, 0) < 0) {
-                                       rcode = 1;
-                                       break;
-                               }
-                       }
-                       line = next + 1;
-               }
-               ++next;
-       }
-       if (rcode == 0 && *line)
-               rcode = (builtin_run_command(line, 0) >= 0);
-
-       return rcode;
-}
-#endif
-
-int run_command_list(const char *cmd, int len, int flag)
-{
-       int need_buff = 1;
-       char *buff = (char *)cmd;       /* cast away const */
-       int rcode = 0;
-
-       if (len == -1) {
-               len = strlen(cmd);
-#ifdef CONFIG_SYS_HUSH_PARSER
-               /* hush will never change our string */
-               need_buff = 0;
-#else
-               /* the built-in parser will change our string if it sees \n */
-               need_buff = strchr(cmd, '\n') != NULL;
-#endif
-       }
-       if (need_buff) {
-               buff = malloc(len + 1);
-               if (!buff)
-                       return 1;
-               memcpy(buff, cmd, len);
-               buff[len] = '\0';
-       }
-#ifdef CONFIG_SYS_HUSH_PARSER
-       rcode = parse_string_outer(buff, FLAG_PARSE_SEMICOLON);
-#else
-       /*
-        * This function will overwrite any \n it sees with a \0, which
-        * is why it can't work with a const char *. Here we are making
-        * using of internal knowledge of this function, to avoid always
-        * doing a malloc() which is actually required only in a case that
-        * is pretty rare.
-        */
-       rcode = builtin_run_command_list(buff, flag);
-       if (need_buff)
-               free(buff);
-#endif
-
-       return rcode;
-}
-
-/****************************************************************************/
-
-#if defined(CONFIG_CMD_RUN)
-int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
-{
-       int i;
-
-       if (argc < 2)
-               return CMD_RET_USAGE;
-
-       for (i=1; i<argc; ++i) {
-               char *arg;
-
-               if ((arg = getenv (argv[i])) == NULL) {
-                       printf ("## Error: \"%s\" not defined\n", argv[i]);
-                       return 1;
-               }
-
-               if (run_command_list(arg, -1, flag) != 0)
-                       return 1;
-       }
-       return 0;
-}
-#endif
index ba393adc32cbf1e3c26f1e6dfcc8f247fd43691a..94afeb290098dc4b1356496ade659d1985fcd143 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <malloc.h>
 #include <errno.h>
 #include <linux/list.h>
@@ -196,8 +197,9 @@ static inline int menu_interactive_choice(struct menu *m, void **choice)
                menu_display(m);
 
                if (!m->item_choice) {
-                       readret = readline_into_buffer("Enter choice: ", cbuf,
-                                       m->timeout / 10);
+                       readret = cli_readline_into_buffer("Enter choice: ",
+                                                          cbuf,
+                                                          m->timeout / 10);
 
                        if (readret >= 0) {
                                choice_item = menu_item_by_key(m, cbuf);
index cf8373b54e826c8877acca3382e21cf9ed3e7197..cc0f73db8f1c70dbca708b5529ed5fee35e8a87e 100644 (file)
@@ -27,3 +27,24 @@ Take AT91SAM9X5EK as an example, the board definition file likes:
 #define CONFIG_ATMEL_NAND_HW_PMECC     1
 #define CONFIG_PMECC_CAP               2
 #define CONFIG_PMECC_SECTOR_SIZE       512
+
+How to enable PMECC header for direct programmable boot.bin
+-----------------------------------------------------------
+2014-05-19 Andreas Bießmann <andreas.devel@googlemail.com>
+
+The usual way to program SPL into NAND flash is to use the SAM-BA Atmel tool.
+This however is often not usable when doing field updates. To be able to
+program a SPL binary into NAND flash we need to add the PMECC header to the
+binary before. Chapter '12.4.4.1 NAND Flash Boot: NAND Flash Detection' in
+sama5d3 SoC spec (as of 03. April 2014) defines how this PMECC header has to
+look like. In order to do so we have a new image type added to mkimage to
+generate this PMECC header and integrated this into the build process of SPL.
+
+To enable the generation of atmel PMECC header for SPL one need to define
+CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER. The required parameters are taken from
+board configuration and compiled into the host tools atmel_pmecc_params. This
+tool will be called in build process to parametrize mkimage for atmelimage
+type. The mkimage tool has intentionally _not_ compiled in those parameters.
+
+The mkimage image type atmelimage also set the 6'th interrupt vector to the
+correct value. This feature can also be used to setup a boot.bin for MMC boot.
index f9742e7d49454f7ec6bf0983109684e12769e237..e2157e08beaa15531f9896339ada14ae8f529ce8 100644 (file)
@@ -11,15 +11,27 @@ easily if here is something they might want to dig for...
 
 Board            Arch        CPU            Commit      Removed     Last known maintainer/contact
 =================================================================================================
-lubbock          arm         pxa            -           2014-04-04  Kyle Harris <kharris@nexus-tech.net>
-MOUSSE           powerpc     mpc824x        -           2014-04-04
-rsdproto         powerpc     mpc8260        -           2014-04-04
-RPXsuper         powerpc     mpc8260        -           2014-04-04
-RPXClassic       powerpc     mpc8xx         -           2014-04-04
-RPXlite          powerpc     mpc8xx         -           2014-04-04
-genietv          powerpc     mpc8xx         -           2014-04-04
-mbx8xx           powerpc     mpc8xx         -           2014-04-04
-nx823            powerpc     mpc8xx         -           2014-04-04
+hidden_dragon    powerpc     mpc824x        -           -           Yusdi Santoso <yusdi_santoso@adaptec.com>
+debris           powerpc     mpc824x        -           -           Sangmoon Kim <dogoil@etinsys.com>
+kvme080          powerpc     mpc824x        -           -           Sangmoon Kim <dogoil@etinsys.com>
+ep8248           powerpc     mpc8260        -           -           Yuli Barcohen <yuli@arabellasw.com>
+ispan            powerpc     mpc8260        -           -           Yuli Barcohen <yuli@arabellasw.com>
+rattler          powerpc     mpc8260        -           -           Yuli Barcohen <yuli@arabellasw.com>
+zpc1900          powerpc     mpc8260        -           -           Yuli Barcohen <yuli@arabellasw.com>
+mpc8260ads       powerpc     mpc8260        -           -           Yuli Barcohen <yuli@arabellasw.com>
+adder            powerpc     mpc8xx         -           -           Yuli Barcohen <yuli@arabellasw.com>
+quad100hd       powerpc     ppc405ep       -           -           Gary Jennejohn <gljennjohn@googlemail.com>
+lubbock          arm         pxa            36bf57b     2014-04-18  Kyle Harris <kharris@nexus-tech.net>
+EVB64260        powerpc     mpc824x        bb3aef9     2014-04-18
+MOUSSE           powerpc     mpc824x        03f2ecc     2014-04-18
+rsdproto         powerpc     mpc8260        8b043e6     2014-04-18
+RPXsuper         powerpc     mpc8260        0ebf5f5     2014-04-18
+RPXClassic       powerpc     mpc8xx         4fb3925     2014-04-18
+RPXlite          powerpc     mpc8xx         4fb3925     2014-04-18
+FADS            powerpc     mpc8xx         aa6e1e4     2014-04-18
+genietv          powerpc     mpc8xx         b8a49bd     2014-04-18
+mbx8xx           powerpc     mpc8xx         d6b11fd     2014-04-18
+nx823            powerpc     mpc8xx         a146e8b     2014-04-18
 idmr             m68k        mcf52x2        ba650e9b    2014-01-28
 M5271EVB         m68k        mcf52x2        ba650e9b    2014-01-28
 dvl_host         arm         ixp            e317de6b    2014-01-28  Michael Schwingen <michael@schwingen.org>
index e0b395a6186a9c1c0cc14403633653e6a5d05e2d..dcecb9a8c0a593c55e1c2e0c250fe18fe0e59543 100644 (file)
@@ -122,7 +122,7 @@ What is going on?
 Let's start at the top. The demo command is in common/cmd_demo.c. It does
 the usual command procesing and then:
 
-       struct device *demo_dev;
+       struct udevice *demo_dev;
 
        ret = uclass_get_device(UCLASS_DEMO, devnum, &demo_dev);
 
@@ -147,7 +147,7 @@ this particular device may use one or other of them.
 
 The code for demo_hello() is in drivers/demo/demo-uclass.c:
 
-int demo_hello(struct device *dev, int ch)
+int demo_hello(struct udevice *dev, int ch)
 {
        const struct demo_ops *ops = device_get_ops(dev);
 
@@ -160,7 +160,7 @@ int demo_hello(struct device *dev, int ch)
 As you can see it just calls the relevant driver method. One of these is
 in drivers/demo/demo-simple.c:
 
-static int simple_hello(struct device *dev, int ch)
+static int simple_hello(struct udevice *dev, int ch)
 {
        const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 
@@ -321,7 +321,7 @@ instead of struct instance, struct platdata, etc.)
 this concept relates to a class of drivers (or a subsystem). We shouldn't
 use 'class' since it is a C++ reserved word, so U-Boot class (uclass) seems
 better than 'core'.
-- Remove 'struct driver_instance' and just use a single 'struct device'.
+- Remove 'struct driver_instance' and just use a single 'struct udevice'.
 This removes a level of indirection that doesn't seem necessary.
 - Built in device tree support, to avoid the need for platdata
 - Removed the concept of driver relocation, and just make it possible for
index 55ba281be0d784c26c3f13a95bd36e32b466c1f1..c73c339d18ca7c7056fb5d6de5ae1808ae6ebcc0 100644 (file)
@@ -30,9 +30,9 @@
  * @dev:       The device that is to be stripped of its children
  * @return 0 on success, -ve on error
  */
-static int device_chld_unbind(struct device *dev)
+static int device_chld_unbind(struct udevice *dev)
 {
-       struct device *pos, *n;
+       struct udevice *pos, *n;
        int ret, saved_ret = 0;
 
        assert(dev);
@@ -51,9 +51,9 @@ static int device_chld_unbind(struct device *dev)
  * @dev:       The device whose children are to be removed
  * @return 0 on success, -ve on error
  */
-static int device_chld_remove(struct device *dev)
+static int device_chld_remove(struct udevice *dev)
 {
-       struct device *pos, *n;
+       struct udevice *pos, *n;
        int ret;
 
        assert(dev);
@@ -67,10 +67,10 @@ static int device_chld_remove(struct device *dev)
        return 0;
 }
 
-int device_bind(struct device *parent, struct driver *drv, const char *name,
-               void *platdata, int of_offset, struct device **devp)
+int device_bind(struct udevice *parent, struct driver *drv, const char *name,
+               void *platdata, int of_offset, struct udevice **devp)
 {
-       struct device *dev;
+       struct udevice *dev;
        struct uclass *uc;
        int ret = 0;
 
@@ -82,7 +82,7 @@ int device_bind(struct device *parent, struct driver *drv, const char *name,
        if (ret)
                return ret;
 
-       dev = calloc(1, sizeof(struct device));
+       dev = calloc(1, sizeof(struct udevice));
        if (!dev)
                return -ENOMEM;
 
@@ -129,8 +129,8 @@ fail_bind:
        return ret;
 }
 
-int device_bind_by_name(struct device *parent, const struct driver_info *info,
-                       struct device **devp)
+int device_bind_by_name(struct udevice *parent, const struct driver_info *info,
+                       struct udevice **devp)
 {
        struct driver *drv;
 
@@ -142,7 +142,7 @@ int device_bind_by_name(struct device *parent, const struct driver_info *info,
                           -1, devp);
 }
 
-int device_unbind(struct device *dev)
+int device_unbind(struct udevice *dev)
 {
        struct driver *drv;
        int ret;
@@ -181,7 +181,7 @@ int device_unbind(struct device *dev)
  * device_free() - Free memory buffers allocated by a device
  * @dev:       Device that is to be started
  */
-static void device_free(struct device *dev)
+static void device_free(struct udevice *dev)
 {
        int size;
 
@@ -200,7 +200,7 @@ static void device_free(struct device *dev)
        }
 }
 
-int device_probe(struct device *dev)
+int device_probe(struct udevice *dev)
 {
        struct driver *drv;
        int size = 0;
@@ -279,7 +279,7 @@ fail:
        return ret;
 }
 
-int device_remove(struct device *dev)
+int device_remove(struct udevice *dev)
 {
        struct driver *drv;
        int ret;
@@ -327,7 +327,7 @@ err:
        return ret;
 }
 
-void *dev_get_platdata(struct device *dev)
+void *dev_get_platdata(struct udevice *dev)
 {
        if (!dev) {
                dm_warn("%s: null device", __func__);
@@ -337,7 +337,7 @@ void *dev_get_platdata(struct device *dev)
        return dev->platdata;
 }
 
-void *dev_get_priv(struct device *dev)
+void *dev_get_priv(struct udevice *dev)
 {
        if (!dev) {
                dm_warn("%s: null device", __func__);
index 4f2c12631d4c0a464e74f54c5fd3ba303e4b5cc5..205b140ef3d7c9d367df75f94ad62c1510454197 100644 (file)
@@ -60,13 +60,13 @@ struct uclass_driver *lists_uclass_lookup(enum uclass_id id)
        return NULL;
 }
 
-int lists_bind_drivers(struct device *parent)
+int lists_bind_drivers(struct udevice *parent)
 {
        struct driver_info *info =
                ll_entry_start(struct driver_info, driver_info);
        const int n_ents = ll_entry_count(struct driver_info, driver_info);
        struct driver_info *entry;
-       struct device *dev;
+       struct udevice *dev;
        int result = 0;
        int ret;
 
@@ -116,12 +116,12 @@ static int driver_check_compatible(const void *blob, int offset,
        return -ENOENT;
 }
 
-int lists_bind_fdt(struct device *parent, const void *blob, int offset)
+int lists_bind_fdt(struct udevice *parent, const void *blob, int offset)
 {
        struct driver *driver = ll_entry_start(struct driver, driver);
        const int n_ents = ll_entry_count(struct driver, driver);
        struct driver *entry;
-       struct device *dev;
+       struct udevice *dev;
        const char *name;
        int result = 0;
        int ret;
index 407bc0d04640b249b3102c62a679bf7a6e0b6bd7..4977875c7f947f60178b60a824a2a109147acbc6 100644 (file)
@@ -24,7 +24,7 @@ static const struct driver_info root_info = {
        .name           = "root_driver",
 };
 
-struct device *dm_root(void)
+struct udevice *dm_root(void)
 {
        if (!gd->dm_root) {
                dm_warn("Virtual root driver does not exist!\n");
index 4df5a8bd399e5602642895e8cf7fad9146df1f4d..f6867e4a23226cf5b7aa631f431da314f256dfc8 100644 (file)
@@ -101,7 +101,7 @@ fail_mem:
 int uclass_destroy(struct uclass *uc)
 {
        struct uclass_driver *uc_drv;
-       struct device *dev, *tmp;
+       struct udevice *dev, *tmp;
        int ret;
 
        list_for_each_entry_safe(dev, tmp, &uc->dev_head, uclass_node) {
@@ -137,10 +137,10 @@ int uclass_get(enum uclass_id id, struct uclass **ucp)
        return 0;
 }
 
-int uclass_find_device(enum uclass_id id, int index, struct device **devp)
+int uclass_find_device(enum uclass_id id, int index, struct udevice **devp)
 {
        struct uclass *uc;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        *devp = NULL;
@@ -158,9 +158,9 @@ int uclass_find_device(enum uclass_id id, int index, struct device **devp)
        return -ENODEV;
 }
 
-int uclass_get_device(enum uclass_id id, int index, struct device **devp)
+int uclass_get_device(enum uclass_id id, int index, struct udevice **devp)
 {
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        *devp = NULL;
@@ -177,10 +177,10 @@ int uclass_get_device(enum uclass_id id, int index, struct device **devp)
        return 0;
 }
 
-int uclass_first_device(enum uclass_id id, struct device **devp)
+int uclass_first_device(enum uclass_id id, struct udevice **devp)
 {
        struct uclass *uc;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        *devp = NULL;
@@ -190,7 +190,7 @@ int uclass_first_device(enum uclass_id id, struct device **devp)
        if (list_empty(&uc->dev_head))
                return 0;
 
-       dev = list_first_entry(&uc->dev_head, struct device, uclass_node);
+       dev = list_first_entry(&uc->dev_head, struct udevice, uclass_node);
        ret = device_probe(dev);
        if (ret)
                return ret;
@@ -199,16 +199,17 @@ int uclass_first_device(enum uclass_id id, struct device **devp)
        return 0;
 }
 
-int uclass_next_device(struct device **devp)
+int uclass_next_device(struct udevice **devp)
 {
-       struct device *dev = *devp;
+       struct udevice *dev = *devp;
        int ret;
 
        *devp = NULL;
        if (list_is_last(&dev->uclass_node, &dev->uclass->dev_head))
                return 0;
 
-       dev = list_entry(dev->uclass_node.next, struct device, uclass_node);
+       dev = list_entry(dev->uclass_node.next, struct udevice,
+                        uclass_node);
        ret = device_probe(dev);
        if (ret)
                return ret;
@@ -217,7 +218,7 @@ int uclass_next_device(struct device **devp)
        return 0;
 }
 
-int uclass_bind_device(struct device *dev)
+int uclass_bind_device(struct udevice *dev)
 {
        struct uclass *uc;
        int ret;
@@ -237,7 +238,7 @@ int uclass_bind_device(struct device *dev)
        return 0;
 }
 
-int uclass_unbind_device(struct device *dev)
+int uclass_unbind_device(struct udevice *dev)
 {
        struct uclass *uc;
        int ret;
@@ -253,7 +254,7 @@ int uclass_unbind_device(struct device *dev)
        return 0;
 }
 
-int uclass_post_probe_device(struct device *dev)
+int uclass_post_probe_device(struct udevice *dev)
 {
        struct uclass_driver *uc_drv = dev->uclass->uc_drv;
 
@@ -263,7 +264,7 @@ int uclass_post_probe_device(struct device *dev)
        return 0;
 }
 
-int uclass_pre_remove_device(struct device *dev)
+int uclass_pre_remove_device(struct udevice *dev)
 {
        struct uclass_driver *uc_drv;
        struct uclass *uc;
index cfe1e1f55aa613035e30ef7818e0daa68c479583..c9f86302d776343f3fbfe5cbe56b11f15805d140 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <cli.h>
 #include <linux/ctype.h>
 #include <asm/types.h>
 #include <asm/io.h>
@@ -1864,11 +1865,12 @@ unsigned long long fsl_ddr_interactive(fsl_ddr_info_t *pinfo, int var_is_set)
                } else {
                        /*
                         * No need to worry for buffer overflow here in
-                        * this function;  readline() maxes out at CFG_CBSIZE
+                        * this function;  cli_readline() maxes out at
+                        * CFG_CBSIZE
                         */
-                       readline_into_buffer(prompt, buffer, 0);
+                       cli_readline_into_buffer(prompt, buffer, 0);
                }
-               argc = parse_line(buffer, argv);
+               argc = cli_simple_parse_line(buffer, argv);
                if (argc == 0)
                        continue;
 
index 2f0eb96bb623508c523a24a3fc7d2c996521b3b7..a68cc1092cf4720e7c6dce8b3ee7775b96b511c1 100644 (file)
@@ -23,7 +23,7 @@ struct shape_data {
 };
 
 /* Crazy little function to draw shapes on the console */
-static int shape_hello(struct device *dev, int ch)
+static int shape_hello(struct udevice *dev, int ch)
 {
        const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
        struct shape_data *data = dev_get_priv(dev);
@@ -81,7 +81,7 @@ static int shape_hello(struct device *dev, int ch)
        return 0;
 }
 
-static int shape_status(struct device *dev, int *status)
+static int shape_status(struct udevice *dev, int *status)
 {
        struct shape_data *data = dev_get_priv(dev);
 
@@ -94,7 +94,7 @@ static const struct demo_ops shape_ops = {
        .status = shape_status,
 };
 
-static int shape_ofdata_to_platdata(struct device *dev)
+static int shape_ofdata_to_platdata(struct udevice *dev)
 {
        struct dm_demo_pdata *pdata = dev_get_platdata(dev);
        int ret;
index 6ba8131728dcf26cdd6ddbcf94c92ea2fa795ee8..11def86032c6b0a319dae3d4add27d061a546bce 100644 (file)
@@ -12,7 +12,7 @@
 #include <dm-demo.h>
 #include <asm/io.h>
 
-static int simple_hello(struct device *dev, int ch)
+static int simple_hello(struct udevice *dev, int ch)
 {
        const struct dm_demo_pdata *pdata = dev_get_platdata(dev);
 
@@ -26,7 +26,7 @@ static const struct demo_ops simple_ops = {
        .hello = simple_hello,
 };
 
-static int demo_shape_ofdata_to_platdata(struct device *dev)
+static int demo_shape_ofdata_to_platdata(struct udevice *dev)
 {
        /* Parse the data that is common with all demo devices */
        return demo_parse_dt(dev);
index 48588be907444239ddff303f84a24847e67bbdeb..636fd8831f5d152310cdd8d7cee1ac7e33c8b492 100644 (file)
@@ -22,7 +22,7 @@ UCLASS_DRIVER(demo) = {
        .id             = UCLASS_DEMO,
 };
 
-int demo_hello(struct device *dev, int ch)
+int demo_hello(struct udevice *dev, int ch)
 {
        const struct demo_ops *ops = device_get_ops(dev);
 
@@ -32,7 +32,7 @@ int demo_hello(struct device *dev, int ch)
        return ops->hello(dev, ch);
 }
 
-int demo_status(struct device *dev, int *status)
+int demo_status(struct udevice *dev, int *status)
 {
        const struct demo_ops *ops = device_get_ops(dev);
 
@@ -42,7 +42,7 @@ int demo_status(struct device *dev, int *status)
        return ops->status(dev, status);
 }
 
-int demo_parse_dt(struct device *dev)
+int demo_parse_dt(struct udevice *dev)
 {
        struct dm_demo_pdata *pdata = dev_get_platdata(dev);
        int dn = dev->of_offset;
index 0b70071871ce8046577fab9453c195d2281bc81d..6517af162815ea8e5715dabb390ed46de12f4617 100644 (file)
@@ -34,6 +34,7 @@ static struct at91_port *at91_pio_get_port(unsigned port)
 #endif
 #endif
        default:
+               printf("Error: at91_gpio: Fail to get PIO base!\n");
                return NULL;
        }
 }
@@ -200,7 +201,7 @@ int at91_set_pio_output(unsigned port, u32 pin, int value)
        struct at91_port *at91_port = at91_pio_get_port(port);
        u32 mask;
 
-       if ((port < ATMEL_PIO_PORTS) && (pin < 32)) {
+       if (at91_port && (port < ATMEL_PIO_PORTS) && (pin < 32)) {
                mask = 1 << pin;
                writel(mask, &at91_port->idr);
                writel(mask, &at91_port->pudr);
index 56bfd114665c91aafeb50d995cc02f6b79a683f7..fa2c2fb7c47c391ca5c505dafd98946f5098171e 100644 (file)
  * or GPIO blocks registered with the GPIO controller. Returns
  * entry on success, NULL on error.
  */
-static int gpio_to_device(unsigned int gpio, struct device **devp,
+static int gpio_to_device(unsigned int gpio, struct udevice **devp,
                          unsigned int *offset)
 {
        struct gpio_dev_priv *uc_priv;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        for (ret = uclass_first_device(UCLASS_GPIO, &dev);
@@ -40,11 +40,11 @@ static int gpio_to_device(unsigned int gpio, struct device **devp,
        return ret ? ret : -EINVAL;
 }
 
-int gpio_lookup_name(const char *name, struct device **devp,
+int gpio_lookup_name(const char *name, struct udevice **devp,
                     unsigned int *offsetp, unsigned int *gpiop)
 {
        struct gpio_dev_priv *uc_priv;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        if (devp)
@@ -86,7 +86,7 @@ int gpio_lookup_name(const char *name, struct device **devp,
 int gpio_request(unsigned gpio, const char *label)
 {
        unsigned int offset;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        ret = gpio_to_device(gpio, &dev, &offset);
@@ -110,7 +110,7 @@ int gpio_request(unsigned gpio, const char *label)
 int gpio_free(unsigned gpio)
 {
        unsigned int offset;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        ret = gpio_to_device(gpio, &dev, &offset);
@@ -133,7 +133,7 @@ int gpio_free(unsigned gpio)
 int gpio_direction_input(unsigned gpio)
 {
        unsigned int offset;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        ret = gpio_to_device(gpio, &dev, &offset);
@@ -155,7 +155,7 @@ int gpio_direction_input(unsigned gpio)
 int gpio_direction_output(unsigned gpio, int value)
 {
        unsigned int offset;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        ret = gpio_to_device(gpio, &dev, &offset);
@@ -177,7 +177,7 @@ int gpio_direction_output(unsigned gpio, int value)
 int gpio_get_value(unsigned gpio)
 {
        unsigned int offset;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        ret = gpio_to_device(gpio, &dev, &offset);
@@ -199,7 +199,7 @@ int gpio_get_value(unsigned gpio)
 int gpio_set_value(unsigned gpio, int value)
 {
        unsigned int offset;
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        ret = gpio_to_device(gpio, &dev, &offset);
@@ -209,7 +209,7 @@ int gpio_set_value(unsigned gpio, int value)
        return gpio_get_ops(dev)->set_value(dev, offset, value);
 }
 
-const char *gpio_get_bank_info(struct device *dev, int *bit_count)
+const char *gpio_get_bank_info(struct udevice *dev, int *bit_count)
 {
        struct gpio_dev_priv *priv;
 
@@ -225,7 +225,7 @@ const char *gpio_get_bank_info(struct device *dev, int *bit_count)
 static int gpio_renumber(void)
 {
        struct gpio_dev_priv *uc_priv;
-       struct device *dev;
+       struct udevice *dev;
        struct uclass *uc;
        unsigned base;
        int ret;
@@ -247,12 +247,12 @@ static int gpio_renumber(void)
        return 0;
 }
 
-static int gpio_post_probe(struct device *dev)
+static int gpio_post_probe(struct udevice *dev)
 {
        return gpio_renumber();
 }
 
-static int gpio_pre_remove(struct device *dev)
+static int gpio_pre_remove(struct udevice *dev)
 {
        return gpio_renumber();
 }
index 22b6a5f7941cb1e8776f9f40e4628da7228c1017..09cebe2286f434317f8072092a0274ac410aefbf 100644 (file)
@@ -22,7 +22,7 @@ struct gpio_state {
 };
 
 /* Access routines for GPIO state */
-static u8 *get_gpio_flags(struct device *dev, unsigned offset)
+static u8 *get_gpio_flags(struct udevice *dev, unsigned offset)
 {
        struct gpio_dev_priv *uc_priv = dev->uclass_priv;
        struct gpio_state *state = dev_get_priv(dev);
@@ -36,12 +36,12 @@ static u8 *get_gpio_flags(struct device *dev, unsigned offset)
        return &state[offset].flags;
 }
 
-static int get_gpio_flag(struct device *dev, unsigned offset, int flag)
+static int get_gpio_flag(struct udevice *dev, unsigned offset, int flag)
 {
        return (*get_gpio_flags(dev, offset) & flag) != 0;
 }
 
-static int set_gpio_flag(struct device *dev, unsigned offset, int flag,
+static int set_gpio_flag(struct udevice *dev, unsigned offset, int flag,
                         int value)
 {
        u8 *gpio = get_gpio_flags(dev, offset);
@@ -54,7 +54,7 @@ static int set_gpio_flag(struct device *dev, unsigned offset, int flag,
        return 0;
 }
 
-static int check_reserved(struct device *dev, unsigned offset,
+static int check_reserved(struct udevice *dev, unsigned offset,
                          const char *func)
 {
        if (!get_gpio_flag(dev, offset, GPIOF_RESERVED)) {
@@ -70,24 +70,24 @@ static int check_reserved(struct device *dev, unsigned offset,
  * Back-channel sandbox-internal-only access to GPIO state
  */
 
-int sandbox_gpio_get_value(struct device *dev, unsigned offset)
+int sandbox_gpio_get_value(struct udevice *dev, unsigned offset)
 {
        if (get_gpio_flag(dev, offset, GPIOF_OUTPUT))
                debug("sandbox_gpio: get_value on output gpio %u\n", offset);
        return get_gpio_flag(dev, offset, GPIOF_HIGH);
 }
 
-int sandbox_gpio_set_value(struct device *dev, unsigned offset, int value)
+int sandbox_gpio_set_value(struct udevice *dev, unsigned offset, int value)
 {
        return set_gpio_flag(dev, offset, GPIOF_HIGH, value);
 }
 
-int sandbox_gpio_get_direction(struct device *dev, unsigned offset)
+int sandbox_gpio_get_direction(struct udevice *dev, unsigned offset)
 {
        return get_gpio_flag(dev, offset, GPIOF_OUTPUT);
 }
 
-int sandbox_gpio_set_direction(struct device *dev, unsigned offset, int output)
+int sandbox_gpio_set_direction(struct udevice *dev, unsigned offset, int output)
 {
        return set_gpio_flag(dev, offset, GPIOF_OUTPUT, output);
 }
@@ -97,7 +97,7 @@ int sandbox_gpio_set_direction(struct device *dev, unsigned offset, int output)
  */
 
 /* set GPIO port 'offset' as an input */
-static int sb_gpio_direction_input(struct device *dev, unsigned offset)
+static int sb_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
        debug("%s: offset:%u\n", __func__, offset);
 
@@ -108,7 +108,7 @@ static int sb_gpio_direction_input(struct device *dev, unsigned offset)
 }
 
 /* set GPIO port 'offset' as an output, with polarity 'value' */
-static int sb_gpio_direction_output(struct device *dev, unsigned offset,
+static int sb_gpio_direction_output(struct udevice *dev, unsigned offset,
                                    int value)
 {
        debug("%s: offset:%u, value = %d\n", __func__, offset, value);
@@ -121,7 +121,7 @@ static int sb_gpio_direction_output(struct device *dev, unsigned offset,
 }
 
 /* read GPIO IN value of port 'offset' */
-static int sb_gpio_get_value(struct device *dev, unsigned offset)
+static int sb_gpio_get_value(struct udevice *dev, unsigned offset)
 {
        debug("%s: offset:%u\n", __func__, offset);
 
@@ -132,7 +132,7 @@ static int sb_gpio_get_value(struct device *dev, unsigned offset)
 }
 
 /* write GPIO OUT value to port 'offset' */
-static int sb_gpio_set_value(struct device *dev, unsigned offset, int value)
+static int sb_gpio_set_value(struct udevice *dev, unsigned offset, int value)
 {
        debug("%s: offset:%u, value = %d\n", __func__, offset, value);
 
@@ -148,7 +148,7 @@ static int sb_gpio_set_value(struct device *dev, unsigned offset, int value)
        return sandbox_gpio_set_value(dev, offset, value);
 }
 
-static int sb_gpio_request(struct device *dev, unsigned offset,
+static int sb_gpio_request(struct udevice *dev, unsigned offset,
                           const char *label)
 {
        struct gpio_dev_priv *uc_priv = dev->uclass_priv;
@@ -171,7 +171,7 @@ static int sb_gpio_request(struct device *dev, unsigned offset,
        return set_gpio_flag(dev, offset, GPIOF_RESERVED, 1);
 }
 
-static int sb_gpio_free(struct device *dev, unsigned offset)
+static int sb_gpio_free(struct udevice *dev, unsigned offset)
 {
        struct gpio_state *state = dev_get_priv(dev);
 
@@ -184,7 +184,7 @@ static int sb_gpio_free(struct device *dev, unsigned offset)
        return set_gpio_flag(dev, offset, GPIOF_RESERVED, 0);
 }
 
-static int sb_gpio_get_state(struct device *dev, unsigned int offset,
+static int sb_gpio_get_state(struct udevice *dev, unsigned int offset,
                             char *buf, int bufsize)
 {
        struct gpio_dev_priv *uc_priv = dev->uclass_priv;
@@ -213,7 +213,7 @@ static const struct dm_gpio_ops gpio_sandbox_ops = {
        .get_state              = sb_gpio_get_state,
 };
 
-static int sandbox_gpio_ofdata_to_platdata(struct device *dev)
+static int sandbox_gpio_ofdata_to_platdata(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev->uclass_priv;
 
@@ -225,7 +225,7 @@ static int sandbox_gpio_ofdata_to_platdata(struct device *dev)
        return 0;
 }
 
-static int gpio_sandbox_probe(struct device *dev)
+static int gpio_sandbox_probe(struct udevice *dev)
 {
        struct gpio_dev_priv *uc_priv = dev->uclass_priv;
 
index 4c6ab9e05b1653173eedd39ecafe39c56e754ed1..34febf52f0ee993b2172236dbd03a4fa7020789c 100644 (file)
@@ -28,6 +28,7 @@ obj-$(CONFIG_SPEAR_SDHCI) += spear_sdhci.o
 obj-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
 obj-$(CONFIG_DWMMC) += dw_mmc.o
 obj-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o
+obj-$(CONFIG_MMC_SUNXI) += sunxi_mmc.o
 obj-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
 obj-$(CONFIG_SOCFPGA_DWMMC) += socfpga_dw_mmc.o
 obj-$(CONFIG_SUPPORT_EMMC_RPMB) += rpmb.o
index acca0269e585a702fd9dfac5877a0bc449ab2b27..a57a9b1faff2f31079dc2349fd2240f82f56a894 100644 (file)
@@ -243,9 +243,10 @@ mci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 #ifdef DEBUG
                        if (data->flags & MMC_DATA_READ)
                        {
+                               u32 cnt = word_count * 4;
                                printf("Read Data:\n");
-                               print_buffer(0, data->dest, 1,
-                                       word_count*4, 0);
+                               print_buffer(0, data->dest + cnt * block_count,
+                                            1, cnt, 0);
                        }
 #endif
 #ifdef DEBUG
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
new file mode 100644 (file)
index 0000000..eb7b115
--- /dev/null
@@ -0,0 +1,503 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Aaron <leafy.myeh@allwinnertech.com>
+ *
+ * MMC driver for allwinner sunxi platform.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/mmc.h>
+
+struct sunxi_mmc_des {
+       u32 reserved1_1:1;
+       u32 dic:1;              /* disable interrupt on completion */
+       u32 last_des:1;         /* 1-this data buffer is the last buffer */
+       u32 first_des:1;                /* 1-data buffer is the first buffer,
+                                  0-data buffer contained in the next
+                                  descriptor is 1st buffer */
+       u32 des_chain:1;        /* 1-the 2nd address in the descriptor is the
+                                  next descriptor address */
+       u32 end_of_ring:1;      /* 1-last descriptor flag when using dual
+                                  data buffer in descriptor */
+       u32 reserved1_2:24;
+       u32 card_err_sum:1;     /* transfer error flag */
+       u32 own:1;              /* des owner:1-idma owns it, 0-host owns it */
+#define SDXC_DES_NUM_SHIFT 16
+#define SDXC_DES_BUFFER_MAX_LEN        (1 << SDXC_DES_NUM_SHIFT)
+       u32 data_buf1_sz:16;
+       u32 data_buf2_sz:16;
+       u32 buf_addr_ptr1;
+       u32 buf_addr_ptr2;
+};
+
+struct sunxi_mmc_host {
+       unsigned mmc_no;
+       uint32_t *mclkreg;
+       unsigned database;
+       unsigned fatal_err;
+       unsigned mod_clk;
+       struct sunxi_mmc *reg;
+       struct mmc_config cfg;
+};
+
+/* support 4 mmc hosts */
+struct sunxi_mmc_host mmc_host[4];
+
+static int mmc_resource_init(int sdc_no)
+{
+       struct sunxi_mmc_host *mmchost = &mmc_host[sdc_no];
+       struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       debug("init mmc %d resource\n", sdc_no);
+
+       switch (sdc_no) {
+       case 0:
+               mmchost->reg = (struct sunxi_mmc *)SUNXI_MMC0_BASE;
+               mmchost->mclkreg = &ccm->sd0_clk_cfg;
+               break;
+       case 1:
+               mmchost->reg = (struct sunxi_mmc *)SUNXI_MMC1_BASE;
+               mmchost->mclkreg = &ccm->sd1_clk_cfg;
+               break;
+       case 2:
+               mmchost->reg = (struct sunxi_mmc *)SUNXI_MMC2_BASE;
+               mmchost->mclkreg = &ccm->sd2_clk_cfg;
+               break;
+       case 3:
+               mmchost->reg = (struct sunxi_mmc *)SUNXI_MMC3_BASE;
+               mmchost->mclkreg = &ccm->sd3_clk_cfg;
+               break;
+       default:
+               printf("Wrong mmc number %d\n", sdc_no);
+               return -1;
+       }
+       mmchost->database = (unsigned int)mmchost->reg + 0x100;
+       mmchost->mmc_no = sdc_no;
+
+       return 0;
+}
+
+static int mmc_clk_io_on(int sdc_no)
+{
+       unsigned int pll_clk;
+       unsigned int divider;
+       struct sunxi_mmc_host *mmchost = &mmc_host[sdc_no];
+       struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+
+       debug("init mmc %d clock and io\n", sdc_no);
+
+       /* config ahb clock */
+       setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_MMC(sdc_no));
+
+       /* config mod clock */
+       pll_clk = clock_get_pll6();
+       /* should be close to 100 MHz but no more, so round up */
+       divider = ((pll_clk + 99999999) / 100000000) - 1;
+       writel(CCM_MMC_CTRL_ENABLE | CCM_MMC_CTRL_PLL6 | divider,
+              mmchost->mclkreg);
+       mmchost->mod_clk = pll_clk / (divider + 1);
+
+       return 0;
+}
+
+static int mmc_update_clk(struct mmc *mmc)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+       unsigned int cmd;
+       unsigned timeout_msecs = 2000;
+
+       cmd = SUNXI_MMC_CMD_START |
+             SUNXI_MMC_CMD_UPCLK_ONLY |
+             SUNXI_MMC_CMD_WAIT_PRE_OVER;
+       writel(cmd, &mmchost->reg->cmd);
+       while (readl(&mmchost->reg->cmd) & SUNXI_MMC_CMD_START) {
+               if (!timeout_msecs--)
+                       return -1;
+               udelay(1000);
+       }
+
+       /* clock update sets various irq status bits, clear these */
+       writel(readl(&mmchost->reg->rint), &mmchost->reg->rint);
+
+       return 0;
+}
+
+static int mmc_config_clock(struct mmc *mmc, unsigned div)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+       unsigned rval = readl(&mmchost->reg->clkcr);
+
+       /* Disable Clock */
+       rval &= ~SUNXI_MMC_CLK_ENABLE;
+       writel(rval, &mmchost->reg->clkcr);
+       if (mmc_update_clk(mmc))
+               return -1;
+
+       /* Change Divider Factor */
+       rval &= ~SUNXI_MMC_CLK_DIVIDER_MASK;
+       rval |= div;
+       writel(rval, &mmchost->reg->clkcr);
+       if (mmc_update_clk(mmc))
+               return -1;
+       /* Re-enable Clock */
+       rval |= SUNXI_MMC_CLK_ENABLE;
+       writel(rval, &mmchost->reg->clkcr);
+
+       if (mmc_update_clk(mmc))
+               return -1;
+
+       return 0;
+}
+
+static void mmc_set_ios(struct mmc *mmc)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+       unsigned int clkdiv = 0;
+
+       debug("set ios: bus_width: %x, clock: %d, mod_clk: %d\n",
+             mmc->bus_width, mmc->clock, mmchost->mod_clk);
+
+       /* Change clock first */
+       clkdiv = (mmchost->mod_clk + (mmc->clock >> 1)) / mmc->clock / 2;
+       if (mmc->clock) {
+               if (mmc_config_clock(mmc, clkdiv)) {
+                       mmchost->fatal_err = 1;
+                       return;
+               }
+       }
+
+       /* Change bus width */
+       if (mmc->bus_width == 8)
+               writel(0x2, &mmchost->reg->width);
+       else if (mmc->bus_width == 4)
+               writel(0x1, &mmchost->reg->width);
+       else
+               writel(0x0, &mmchost->reg->width);
+}
+
+static int mmc_core_init(struct mmc *mmc)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+
+       /* Reset controller */
+       writel(SUNXI_MMC_GCTRL_RESET, &mmchost->reg->gctrl);
+
+       return 0;
+}
+
+static int mmc_trans_data_by_cpu(struct mmc *mmc, struct mmc_data *data)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+       const int reading = !!(data->flags & MMC_DATA_READ);
+       const uint32_t status_bit = reading ? SUNXI_MMC_STATUS_FIFO_EMPTY :
+                                             SUNXI_MMC_STATUS_FIFO_FULL;
+       unsigned i;
+       unsigned byte_cnt = data->blocksize * data->blocks;
+       unsigned timeout_msecs = 2000;
+       unsigned *buff = (unsigned int *)(reading ? data->dest : data->src);
+
+       for (i = 0; i < (byte_cnt >> 2); i++) {
+               while (readl(&mmchost->reg->status) & status_bit) {
+                       if (!timeout_msecs--)
+                               return -1;
+                       udelay(1000);
+               }
+
+               if (reading)
+                       buff[i] = readl(mmchost->database);
+               else
+                       writel(buff[i], mmchost->database);
+       }
+
+       return 0;
+}
+
+static int mmc_trans_data_by_dma(struct mmc *mmc, struct mmc_data *data)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+       unsigned byte_cnt = data->blocksize * data->blocks;
+       unsigned char *buff;
+       unsigned des_idx = 0;
+       unsigned buff_frag_num =
+               (byte_cnt + SDXC_DES_BUFFER_MAX_LEN - 1) >> SDXC_DES_NUM_SHIFT;
+       unsigned remain;
+       unsigned i, rval;
+       ALLOC_CACHE_ALIGN_BUFFER(struct sunxi_mmc_des, pdes, buff_frag_num);
+
+       buff = data->flags & MMC_DATA_READ ?
+           (unsigned char *)data->dest : (unsigned char *)data->src;
+       remain = byte_cnt & (SDXC_DES_BUFFER_MAX_LEN - 1);
+
+       flush_cache((unsigned long)buff, (unsigned long)byte_cnt);
+       for (i = 0; i < buff_frag_num; i++, des_idx++) {
+               memset((void *)&pdes[des_idx], 0, sizeof(struct sunxi_mmc_des));
+               pdes[des_idx].des_chain = 1;
+               pdes[des_idx].own = 1;
+               pdes[des_idx].dic = 1;
+               if (buff_frag_num > 1 && i != buff_frag_num - 1)
+                       pdes[des_idx].data_buf1_sz = 0; /* 0 == max_len */
+               else
+                       pdes[des_idx].data_buf1_sz = remain;
+
+               pdes[des_idx].buf_addr_ptr1 =
+                   (u32) buff + i * SDXC_DES_BUFFER_MAX_LEN;
+               if (i == 0)
+                       pdes[des_idx].first_des = 1;
+
+               if (i == buff_frag_num - 1) {
+                       pdes[des_idx].dic = 0;
+                       pdes[des_idx].last_des = 1;
+                       pdes[des_idx].end_of_ring = 1;
+                       pdes[des_idx].buf_addr_ptr2 = 0;
+               } else {
+                       pdes[des_idx].buf_addr_ptr2 = (u32)&pdes[des_idx + 1];
+               }
+       }
+       flush_cache((unsigned long)pdes,
+                   sizeof(struct sunxi_mmc_des) * (des_idx + 1));
+
+       rval = readl(&mmchost->reg->gctrl);
+       /* Enable DMA */
+       writel(rval | SUNXI_MMC_GCTRL_DMA_RESET | SUNXI_MMC_GCTRL_DMA_ENABLE,
+              &mmchost->reg->gctrl);
+       /* Reset iDMA */
+       writel(SUNXI_MMC_IDMAC_RESET, &mmchost->reg->dmac);
+       /* Enable iDMA */
+       writel(SUNXI_MMC_IDMAC_FIXBURST | SUNXI_MMC_IDMAC_ENABLE,
+              &mmchost->reg->dmac);
+       rval = readl(&mmchost->reg->idie) &
+               ~(SUNXI_MMC_IDIE_TXIRQ|SUNXI_MMC_IDIE_RXIRQ);
+       if (data->flags & MMC_DATA_WRITE)
+               rval |= SUNXI_MMC_IDIE_TXIRQ;
+       else
+               rval |= SUNXI_MMC_IDIE_RXIRQ;
+       writel(rval, &mmchost->reg->idie);
+       writel((u32) pdes, &mmchost->reg->dlba);
+       writel((0x2 << 28) | (0x7 << 16) | (0x01 << 3),
+              &mmchost->reg->ftrglevel);
+
+       return 0;
+}
+
+static void mmc_enable_dma_accesses(struct mmc *mmc, int dma)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+
+       unsigned int gctrl = readl(&mmchost->reg->gctrl);
+       if (dma)
+               gctrl &= ~SUNXI_MMC_GCTRL_ACCESS_BY_AHB;
+       else
+               gctrl |= SUNXI_MMC_GCTRL_ACCESS_BY_AHB;
+       writel(gctrl, &mmchost->reg->gctrl);
+}
+
+static int mmc_rint_wait(struct mmc *mmc, unsigned int timeout_msecs,
+                        unsigned int done_bit, const char *what)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+       unsigned int status;
+
+       do {
+               status = readl(&mmchost->reg->rint);
+               if (!timeout_msecs-- ||
+                   (status & SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT)) {
+                       debug("%s timeout %x\n", what,
+                             status & SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT);
+                       return TIMEOUT;
+               }
+               udelay(1000);
+       } while (!(status & done_bit));
+
+       return 0;
+}
+
+static int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd,
+                       struct mmc_data *data)
+{
+       struct sunxi_mmc_host *mmchost = mmc->priv;
+       unsigned int cmdval = SUNXI_MMC_CMD_START;
+       unsigned int timeout_msecs;
+       int error = 0;
+       unsigned int status = 0;
+       unsigned int usedma = 0;
+       unsigned int bytecnt = 0;
+
+       if (mmchost->fatal_err)
+               return -1;
+       if (cmd->resp_type & MMC_RSP_BUSY)
+               debug("mmc cmd %d check rsp busy\n", cmd->cmdidx);
+       if (cmd->cmdidx == 12)
+               return 0;
+
+       if (!cmd->cmdidx)
+               cmdval |= SUNXI_MMC_CMD_SEND_INIT_SEQ;
+       if (cmd->resp_type & MMC_RSP_PRESENT)
+               cmdval |= SUNXI_MMC_CMD_RESP_EXPIRE;
+       if (cmd->resp_type & MMC_RSP_136)
+               cmdval |= SUNXI_MMC_CMD_LONG_RESPONSE;
+       if (cmd->resp_type & MMC_RSP_CRC)
+               cmdval |= SUNXI_MMC_CMD_CHK_RESPONSE_CRC;
+
+       if (data) {
+               if ((u32) data->dest & 0x3) {
+                       error = -1;
+                       goto out;
+               }
+
+               cmdval |= SUNXI_MMC_CMD_DATA_EXPIRE|SUNXI_MMC_CMD_WAIT_PRE_OVER;
+               if (data->flags & MMC_DATA_WRITE)
+                       cmdval |= SUNXI_MMC_CMD_WRITE;
+               if (data->blocks > 1)
+                       cmdval |= SUNXI_MMC_CMD_AUTO_STOP;
+               writel(data->blocksize, &mmchost->reg->blksz);
+               writel(data->blocks * data->blocksize, &mmchost->reg->bytecnt);
+       }
+
+       debug("mmc %d, cmd %d(0x%08x), arg 0x%08x\n", mmchost->mmc_no,
+             cmd->cmdidx, cmdval | cmd->cmdidx, cmd->cmdarg);
+       writel(cmd->cmdarg, &mmchost->reg->arg);
+
+       if (!data)
+               writel(cmdval | cmd->cmdidx, &mmchost->reg->cmd);
+
+       /*
+        * transfer data and check status
+        * STATREG[2] : FIFO empty
+        * STATREG[3] : FIFO full
+        */
+       if (data) {
+               int ret = 0;
+
+               bytecnt = data->blocksize * data->blocks;
+               debug("trans data %d bytes\n", bytecnt);
+#if defined(CONFIG_MMC_SUNXI_USE_DMA) && !defined(CONFIG_SPL_BUILD)
+               if (bytecnt > 64) {
+#else
+               if (0) {
+#endif
+                       usedma = 1;
+                       mmc_enable_dma_accesses(mmc, 1);
+                       ret = mmc_trans_data_by_dma(mmc, data);
+                       writel(cmdval | cmd->cmdidx, &mmchost->reg->cmd);
+               } else {
+                       mmc_enable_dma_accesses(mmc, 0);
+                       writel(cmdval | cmd->cmdidx, &mmchost->reg->cmd);
+                       ret = mmc_trans_data_by_cpu(mmc, data);
+               }
+               if (ret) {
+                       error = readl(&mmchost->reg->rint) & \
+                               SUNXI_MMC_RINT_INTERRUPT_ERROR_BIT;
+                       error = TIMEOUT;
+                       goto out;
+               }
+       }
+
+       error = mmc_rint_wait(mmc, 0xfffff, SUNXI_MMC_RINT_COMMAND_DONE, "cmd");
+       if (error)
+               goto out;
+
+       if (data) {
+               timeout_msecs = usedma ? 120 * bytecnt : 120;
+               debug("cacl timeout %x msec\n", timeout_msecs);
+               error = mmc_rint_wait(mmc, timeout_msecs,
+                                     data->blocks > 1 ?
+                                     SUNXI_MMC_RINT_AUTO_COMMAND_DONE :
+                                     SUNXI_MMC_RINT_DATA_OVER,
+                                     "data");
+               if (error)
+                       goto out;
+       }
+
+       if (cmd->resp_type & MMC_RSP_BUSY) {
+               timeout_msecs = 2000;
+               do {
+                       status = readl(&mmchost->reg->status);
+                       if (!timeout_msecs--) {
+                               debug("busy timeout\n");
+                               error = TIMEOUT;
+                               goto out;
+                       }
+                       udelay(1000);
+               } while (status & SUNXI_MMC_STATUS_CARD_DATA_BUSY);
+       }
+
+       if (cmd->resp_type & MMC_RSP_136) {
+               cmd->response[0] = readl(&mmchost->reg->resp3);
+               cmd->response[1] = readl(&mmchost->reg->resp2);
+               cmd->response[2] = readl(&mmchost->reg->resp1);
+               cmd->response[3] = readl(&mmchost->reg->resp0);
+               debug("mmc resp 0x%08x 0x%08x 0x%08x 0x%08x\n",
+                     cmd->response[3], cmd->response[2],
+                     cmd->response[1], cmd->response[0]);
+       } else {
+               cmd->response[0] = readl(&mmchost->reg->resp0);
+               debug("mmc resp 0x%08x\n", cmd->response[0]);
+       }
+out:
+       if (data && usedma) {
+               /* IDMASTAREG
+                * IDST[0] : idma tx int
+                * IDST[1] : idma rx int
+                * IDST[2] : idma fatal bus error
+                * IDST[4] : idma descriptor invalid
+                * IDST[5] : idma error summary
+                * IDST[8] : idma normal interrupt sumary
+                * IDST[9] : idma abnormal interrupt sumary
+                */
+               status = readl(&mmchost->reg->idst);
+               writel(status, &mmchost->reg->idst);
+               writel(0, &mmchost->reg->idie);
+               writel(0, &mmchost->reg->dmac);
+               writel(readl(&mmchost->reg->gctrl) & ~SUNXI_MMC_GCTRL_DMA_ENABLE,
+                      &mmchost->reg->gctrl);
+       }
+       if (error < 0) {
+               writel(SUNXI_MMC_GCTRL_RESET, &mmchost->reg->gctrl);
+               mmc_update_clk(mmc);
+       }
+       writel(0xffffffff, &mmchost->reg->rint);
+       writel(readl(&mmchost->reg->gctrl) | SUNXI_MMC_GCTRL_FIFO_RESET,
+              &mmchost->reg->gctrl);
+
+       return error;
+}
+
+static const struct mmc_ops sunxi_mmc_ops = {
+       .send_cmd       = mmc_send_cmd,
+       .set_ios        = mmc_set_ios,
+       .init           = mmc_core_init,
+};
+
+int sunxi_mmc_init(int sdc_no)
+{
+       struct mmc_config *cfg = &mmc_host[sdc_no].cfg;
+
+       memset(&mmc_host[sdc_no], 0, sizeof(struct sunxi_mmc_host));
+
+       cfg->name = "SUNXI SD/MMC";
+       cfg->ops  = &sunxi_mmc_ops;
+
+       cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
+       cfg->host_caps = MMC_MODE_4BIT;
+       cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
+       cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
+
+       cfg->f_min = 400000;
+       cfg->f_max = 52000000;
+
+       mmc_resource_init(sdc_no);
+       mmc_clk_io_on(sdc_no);
+
+       if (mmc_create(cfg, &mmc_host[sdc_no]) == NULL)
+               return -1;
+
+       return 0;
+}
index 78751b2600c683a9bb9079c0a28b8c7beeab266c..7186e3b491ecabd6128720a6284a1ef42d4b93c0 100644 (file)
@@ -249,7 +249,7 @@ static int dw_eth_init(struct eth_device *dev, bd_t *bis)
        rx_descs_init(dev);
        tx_descs_init(dev);
 
-       writel(FIXEDBURST | PRIORXTX_41 | BURST_16, &dma_p->busmode);
+       writel(FIXEDBURST | PRIORXTX_41 | DMA_PBL, &dma_p->busmode);
 
        writel(readl(&dma_p->opmode) | FLUSHTXFIFO | STOREFORWARD,
               &dma_p->opmode);
@@ -280,10 +280,18 @@ static int dw_eth_send(struct eth_device *dev, void *packet, int length)
        u32 desc_num = priv->tx_currdescnum;
        struct dmamacdescr *desc_p = &priv->tx_mac_descrtable[desc_num];
 
-       /* Invalidate only "status" field for the following check */
-       invalidate_dcache_range((unsigned long)&desc_p->txrx_status,
-                               (unsigned long)&desc_p->txrx_status +
-                               sizeof(desc_p->txrx_status));
+       /*
+        * Strictly we only need to invalidate the "txrx_status" field
+        * for the following check, but on some platforms we cannot
+        * invalidate only 4 bytes, so roundup to
+        * ARCH_DMA_MINALIGN. This is safe because the individual
+        * descriptors in the array are each aligned to
+        * ARCH_DMA_MINALIGN.
+        */
+       invalidate_dcache_range(
+               (unsigned long)desc_p,
+               (unsigned long)desc_p +
+               roundup(sizeof(desc_p->txrx_status), ARCH_DMA_MINALIGN));
 
        /* Check if the descriptor is owned by CPU */
        if (desc_p->txrx_status & DESC_TXSTS_OWNBYDMA) {
@@ -351,7 +359,7 @@ static int dw_eth_recv(struct eth_device *dev)
                /* Invalidate received data */
                invalidate_dcache_range((unsigned long)desc_p->dmamac_addr,
                                        (unsigned long)desc_p->dmamac_addr +
-                                       length);
+                                       roundup(length, ARCH_DMA_MINALIGN));
 
                NetReceive(desc_p->dmamac_addr, length);
 
@@ -414,7 +422,8 @@ int designware_initialize(ulong base_addr, u32 interface)
         * Since the priv structure contains the descriptors which need a strict
         * buswidth alignment, memalign is used to allocate memory
         */
-       priv = (struct dw_eth_dev *) memalign(16, sizeof(struct dw_eth_dev));
+       priv = (struct dw_eth_dev *) memalign(ARCH_DMA_MINALIGN,
+                                             sizeof(struct dw_eth_dev));
        if (!priv) {
                free(dev);
                return -ENOMEM;
index 382b0c7f0a66c2a9dd4dab562a13f16f780e2bda..ce51102052eafad7e2b8fdb764f3cf91b33c5d2e 100644 (file)
@@ -77,18 +77,18 @@ struct eth_dma_regs {
 
 #define DW_DMA_BASE_OFFSET     (0x1000)
 
+/* Default DMA Burst length */
+#ifndef CONFIG_DW_GMAC_DEFAULT_DMA_PBL
+#define CONFIG_DW_GMAC_DEFAULT_DMA_PBL 8
+#endif
+
 /* Bus mode register definitions */
 #define FIXEDBURST             (1 << 16)
 #define PRIORXTX_41            (3 << 14)
 #define PRIORXTX_31            (2 << 14)
 #define PRIORXTX_21            (1 << 14)
 #define PRIORXTX_11            (0 << 14)
-#define BURST_1                        (1 << 8)
-#define BURST_2                        (2 << 8)
-#define BURST_4                        (4 << 8)
-#define BURST_8                        (8 << 8)
-#define BURST_16               (16 << 8)
-#define BURST_32               (32 << 8)
+#define DMA_PBL                        (CONFIG_DW_GMAC_DEFAULT_DMA_PBL<<8)
 #define RXHIGHPRIO             (1 << 1)
 #define DMAMAC_SRST            (1 << 0)
 
@@ -215,15 +215,14 @@ struct dmamacdescr {
 #endif
 
 struct dw_eth_dev {
-       u32 interface;
-       u32 tx_currdescnum;
-       u32 rx_currdescnum;
-
        struct dmamacdescr tx_mac_descrtable[CONFIG_TX_DESCR_NUM];
        struct dmamacdescr rx_mac_descrtable[CONFIG_RX_DESCR_NUM];
+       char txbuffs[TX_TOTAL_BUFSIZE] __aligned(ARCH_DMA_MINALIGN);
+       char rxbuffs[RX_TOTAL_BUFSIZE] __aligned(ARCH_DMA_MINALIGN);
 
-       char txbuffs[TX_TOTAL_BUFSIZE];
-       char rxbuffs[RX_TOTAL_BUFSIZE];
+       u32 interface;
+       u32 tx_currdescnum;
+       u32 rx_currdescnum;
 
        struct eth_mac_regs *mac_regs_p;
        struct eth_dma_regs *dma_regs_p;
index e98b661e358815b1ab375b66675bf964eacf5d12..2850ed8a69f486000a6fb435928757739b4d2033 100644 (file)
@@ -65,7 +65,7 @@ typedef struct global_data {
        struct global_data *new_gd;     /* relocated global data */
 
 #ifdef CONFIG_DM
-       struct device   *dm_root;       /* Root instance for Driver Model */
+       struct udevice  *dm_root;/* Root instance for Driver Model */
        struct list_head uclass_root;   /* Head of core tree */
 #endif
 
index e325df40d9326fe46ebd1461446dab6124c6da7c..a6e52a0de63cd3d535674a140d6d4b4cac966264 100644 (file)
@@ -86,7 +86,7 @@ enum {
        GPIOF_UNKNOWN,
 };
 
-struct device;
+struct udevice;
 
 /**
  * struct struct dm_gpio_ops - Driver model GPIO operations
@@ -116,15 +116,15 @@ struct device;
  * all devices. Be careful not to confuse offset with gpio in the parameters.
  */
 struct dm_gpio_ops {
-       int (*request)(struct device *dev, unsigned offset, const char *label);
-       int (*free)(struct device *dev, unsigned offset);
-       int (*direction_input)(struct device *dev, unsigned offset);
-       int (*direction_output)(struct device *dev, unsigned offset,
+       int (*request)(struct udevice *dev, unsigned offset, const char *label);
+       int (*free)(struct udevice *dev, unsigned offset);
+       int (*direction_input)(struct udevice *dev, unsigned offset);
+       int (*direction_output)(struct udevice *dev, unsigned offset,
                                int value);
-       int (*get_value)(struct device *dev, unsigned offset);
-       int (*set_value)(struct device *dev, unsigned offset, int value);
-       int (*get_function)(struct device *dev, unsigned offset);
-       int (*get_state)(struct device *dev, unsigned offset, char *state,
+       int (*get_value)(struct udevice *dev, unsigned offset);
+       int (*set_value)(struct udevice *dev, unsigned offset, int value);
+       int (*get_function)(struct udevice *dev, unsigned offset);
+       int (*get_state)(struct udevice *dev, unsigned offset, char *state,
                         int maxlen);
 };
 
@@ -166,7 +166,7 @@ struct gpio_dev_priv {
  * @offset_count: Returns number of GPIOs within this bank
  * @return bank name of this device
  */
-const char *gpio_get_bank_info(struct device *dev, int *offset_count);
+const char *gpio_get_bank_info(struct udevice *dev, int *offset_count);
 
 /**
  * gpio_lookup_name - Look up a GPIO name and return its details
@@ -179,7 +179,7 @@ const char *gpio_get_bank_info(struct device *dev, int *offset_count);
  * @offsetp: Returns the offset number within this device
  * @gpiop: Returns the absolute GPIO number, numbered from 0
  */
-int gpio_lookup_name(const char *name, struct device **devp,
+int gpio_lookup_name(const char *name, struct udevice **devp,
                     unsigned int *offsetp, unsigned int *gpiop);
 
 #endif /* _ASM_GENERIC_GPIO_H_ */
diff --git a/include/autoboot.h b/include/autoboot.h
new file mode 100644 (file)
index 0000000..3a9059a
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * Add to readline cmdline-editing by
+ * (C) Copyright 2005
+ * JinHua Luo, GuangDong Linux Center, <luo.jinhua@gd-linux.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __AUTOBOOT_H
+#define __AUTOBOOT_H
+
+#ifdef CONFIG_BOOTDELAY
+/**
+ * bootdelay_process() - process the bootd delay
+ *
+ * Process the boot delay, boot limit, then get the value of either
+ * bootcmd, failbootcmd or altbootcmd depending on the current state.
+ * Return this command so it can be executed.
+ *
+ * @return command to executed
+ */
+const char *bootdelay_process(void);
+
+/**
+ * autoboot_command() - run the autoboot command
+ *
+ * If enabled, run the autoboot command returned from bootdelay_process().
+ * Also do the CONFIG_MENUKEY processing if enabled.
+ *
+ * @cmd: Command to run
+ */
+void autoboot_command(const char *cmd);
+#else
+static inline const char *bootdelay_process(void)
+{
+       return NULL;
+}
+
+static inline void autoboot_command(const char *s)
+{
+}
+#endif
+
+#endif
diff --git a/include/bootretry.h b/include/bootretry.h
new file mode 100644 (file)
index 0000000..2ecd7a4
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __BOOTRETRY_H
+#define __BOOTRETRY_H
+
+#ifdef CONFIG_BOOT_RETRY_TIME
+/**
+ * bootretry_tstc_timeout() - ensure we get a keypress before timeout
+ *
+ * Check for a keypress repeatedly, resetting the watchdog each time. If a
+ * keypress is not received within the command timeout, return an error.
+ *
+ * @return 0 if a key is received in time, -ETIMEDOUT if not
+ */
+int bootretry_tstc_timeout(void);
+
+/**
+ * bootretry_init_cmd_timeout() - set up command timeout
+ *
+ * Get the required command timeout from the environment.
+ */
+void bootretry_init_cmd_timeout(void);
+
+/**
+ * bootretry_reset_cmd_timeout() - reset command timeout
+ *
+ * Reset the command timeout so that the user has a fresh start. This is
+ * typically used when input is received from the user.
+ */
+void bootretry_reset_cmd_timeout(void);
+
+/** bootretry_dont_retry() - Indicate that we should not retry the boot */
+void bootretry_dont_retry(void);
+#else
+static inline int bootretry_tstc_timeout(void)
+{
+       return 0;
+}
+
+static inline void bootretry_init_cmd_timeout(void)
+{
+}
+
+static inline void bootretry_reset_cmd_timeout(void)
+{
+}
+
+static inline void bootretry_dont_retry(void)
+{
+}
+
+#endif
+
+#endif
diff --git a/include/cli.h b/include/cli.h
new file mode 100644 (file)
index 0000000..6994262
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * (C) Copyright 2014 Google, Inc
+ * Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef __CLI_H
+#define __CLI_H
+
+/**
+ * Go into the command loop
+ *
+ * This will return if we get a timeout waiting for a command. See
+ * CONFIG_BOOT_RETRY_TIME.
+ */
+void cli_simple_loop(void);
+
+/**
+ * cli_simple_run_command() - Execute a command with the simple CLI
+ *
+ * @cmd:       String containing the command to execute
+ * @flag       Flag value - see CMD_FLAG_...
+ * @return 1  - command executed, repeatable
+ *     0  - command executed but not repeatable, interrupted commands are
+ *          always considered not repeatable
+ *     -1 - not executed (unrecognized, bootd recursion or too many args)
+ *           (If cmd is NULL or "" or longer than CONFIG_SYS_CBSIZE-1 it is
+ *           considered unrecognized)
+ */
+int cli_simple_run_command(const char *cmd, int flag);
+
+/**
+ * cli_simple_run_command_list() - Execute a list of command
+ *
+ * The commands should be separated by ; or \n and will be executed
+ * by the built-in parser.
+ *
+ * This function cannot take a const char * for the command, since if it
+ * finds newlines in the string, it replaces them with \0.
+ *
+ * @param cmd  String containing list of commands
+ * @param flag Execution flags (CMD_FLAG_...)
+ * @return 0 on success, or != 0 on error.
+ */
+int cli_simple_run_command_list(char *cmd, int flag);
+
+/**
+ * cli_readline() - read a line into the console_buffer
+ *
+ * This is a convenience function which calls cli_readline_into_buffer().
+ *
+ * @prompt: Prompt to display
+ * @return command line length excluding terminator, or -ve on error
+ */
+int cli_readline(const char *const prompt);
+
+/**
+ * readline_into_buffer() - read a line into a buffer
+ *
+ * Display the prompt, then read a command line into @buffer. The
+ * maximum line length is CONFIG_SYS_CBSIZE including a \0 terminator, which
+ * will always be added.
+ *
+ * The command is echoed as it is typed. Command editing is supported if
+ * CONFIG_CMDLINE_EDITING is defined. Tab auto-complete is supported if
+ * CONFIG_AUTO_COMPLETE is defined. If CONFIG_BOOT_RETRY_TIME is defined,
+ * then a timeout will be applied.
+ *
+ * If CONFIG_BOOT_RETRY_TIME is defined and retry_time >= 0,
+ * time out when time goes past endtime (timebase time in ticks).
+ *
+ * @prompt:    Prompt to display
+ * @buffer:    Place to put the line that is entered
+ * @timeout:   Timeout in milliseconds, 0 if none
+ * @return command line length excluding terminator, or -ve on error: of the
+ * timeout is exceeded (either CONFIG_BOOT_RETRY_TIME or the timeout
+ * parameter), then -2 is returned. If a break is detected (Ctrl-C) then
+ * -1 is returned.
+ */
+int cli_readline_into_buffer(const char *const prompt, char *buffer,
+                               int timeout);
+
+/**
+ * parse_line() - split a command line down into separate arguments
+ *
+ * The argv[] array is filled with pointers into @line, and each argument
+ * is terminated by \0 (i.e. @line is changed in the process unless there
+ * is only one argument).
+ *
+ * #argv is terminated by a NULL after the last argument pointer.
+ *
+ * At most CONFIG_SYS_MAXARGS arguments are permited - if there are more
+ * than that then an error is printed, and this function returns
+ * CONFIG_SYS_MAXARGS, with argv[] set up to that point.
+ *
+ * @line:      Command line to parse
+ * @args:      Array to hold arguments
+ * @return number of arguments
+ */
+int cli_simple_parse_line(char *line, char *argv[]);
+
+#ifdef CONFIG_OF_CONTROL
+/**
+ * cli_process_fdt() - process the boot command from the FDT
+ *
+ * If bootcmmd is defined in the /config node of the FDT, we use that
+ * as the boot command. Further, if bootsecure is set to 1 (in the same
+ * node) then we return true, indicating that the command should be executed
+ * as securely as possible, avoiding the CLI parser.
+ *
+ * @cmdp:      On entry, the command that will be executed if the FDT does
+ *             not have a command. Returns the command to execute after
+ *             checking the FDT.
+ * @return true to execute securely, else false
+ */
+bool cli_process_fdt(const char **cmdp);
+
+/** cli_secure_boot_cmd() - execute a command as securely as possible
+ *
+ * This avoids using the parser, thus executing the command with the
+ * smallest amount of code. Parameters are not supported.
+ */
+void cli_secure_boot_cmd(const char *cmd);
+#else
+static inline bool cli_process_fdt(const char **cmdp)
+{
+       return false;
+}
+
+static inline void cli_secure_boot_cmd(const char *cmd)
+{
+}
+#endif /* CONFIG_OF_CONTROL */
+
+/**
+ * Go into the command loop
+ *
+ * This will return if we get a timeout waiting for a command, but only for
+ * the simple parser (not hush). See CONFIG_BOOT_RETRY_TIME.
+ */
+void cli_loop(void);
+
+/** Set up the command line interpreter ready for action */
+void cli_init(void);
+
+#define endtick(seconds) (get_ticks() + (uint64_t)(seconds) * get_tbclk())
+
+#endif
similarity index 93%
rename from include/hush.h
rename to include/cli_hush.h
index 595303a6521f3acbfdabe4d6ebc3f8878d6e3859..4951eef5724305519038ca739a77c60e087a5fa5 100644 (file)
@@ -5,8 +5,8 @@
  * SPDX-License-Identifier:    GPL-2.0+
  */
 
-#ifndef _HUSH_H_
-#define _HUSH_H_
+#ifndef _CLI_HUSH_H_
+#define _CLI_HUSH_H_
 
 #define FLAG_EXIT_FROM_LOOP 1
 #define FLAG_PARSE_SEMICOLON (1 << 1)    /* symbol ';' is special for parser */
index 232136c0cd1340b8c7bd941a67996ee9c58e2e1c..91dc0f3c100bb43db9d7f75a425d426057dae7a9 100644 (file)
@@ -54,8 +54,6 @@ typedef volatile unsigned char        vu_char;
 #include <asm/immap_512x.h>
 #elif defined(CONFIG_MPC8260)
 #if   defined(CONFIG_MPC8247) \
-   || defined(CONFIG_MPC8248) \
-   || defined(CONFIG_MPC8271) \
    || defined(CONFIG_MPC8272)
 #define CONFIG_MPC8272_FAMILY  1
 #endif
@@ -286,12 +284,6 @@ int run_command(const char *cmd, int flag);
  * @return 0 on success, or != 0 on error.
  */
 int run_command_list(const char *cmd, int len, int flag);
-int    readline        (const char *const prompt);
-int    readline_into_buffer(const char *const prompt, char *buffer,
-                       int timeout);
-int    parse_line (char *, char *[]);
-void   init_cmd_timeout(void);
-void   reset_cmd_timeout(void);
 extern char console_buffer[];
 
 /* arch/$(ARCH)/lib/board.c */
@@ -305,6 +297,7 @@ extern ulong monitor_flash_len;
 int mac_read_from_eeprom(void);
 extern u8 __dtb_dt_begin[];    /* embedded device tree blob */
 int set_cpu_clk_info(void);
+int mdm_init(void);
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void);
 #else
diff --git a/include/configs/Adder.h b/include/configs/Adder.h
deleted file mode 100644 (file)
index 140f443..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2004-2005 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * Support for Analogue&Micro Adder boards family.
- * Tested on AdderII and Adder87x.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#if !defined(CONFIG_MPC875) && !defined(CONFIG_MPC852T)
-#define CONFIG_MPC875
-#endif
-
-#define CONFIG_ADDER                           /* Analogue&Micro Adder board   */
-
-#define        CONFIG_SYS_TEXT_BASE    0xFE000000
-
-#define        CONFIG_8xx_CONS_SMC1    1               /* Console is on SMC1           */
-#define CONFIG_BAUDRATE                38400
-
-#define CONFIG_ETHER_ON_FEC1
-#define CONFIG_ETHER_ON_FEC2
-#define CONFIG_HAS_ETH0
-#define CONFIG_HAS_ETH1
-
-#if defined(CONFIG_ETHER_ON_FEC1) || defined(CONFIG_ETHER_ON_FEC2)
-#define CONFIG_SYS_DISCOVER_PHY
-#define CONFIG_MII_INIT                1
-#define FEC_ENET
-#endif /* CONFIG_ETHER_ON_FEC || CONFIG_ETHER_ON_FEC2 */
-
-#define CONFIG_8xx_OSCLK               10000000 /* 10 MHz oscillator on EXTCLK */
-#define CONFIG_8xx_CPUCLK_DEFAULT      50000000
-#define CONFIG_SYS_8xx_CPUCLK_MIN              40000000
-#ifdef CONFIG_MPC852T
-#define CONFIG_SYS_8xx_CPUCLK_MAX              50000000
-#else
-#define CONFIG_SYS_8xx_CPUCLK_MAX              133000000
-#endif /* CONFIG_MPC852T */
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_IMMAP
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_PING
-
-
-#define CONFIG_BOOTDELAY       5               /* Autoboot after 5 seconds     */
-#define CONFIG_BOOTCOMMAND     "bootm fe040000"        /* Autoboot command     */
-#define CONFIG_BOOTARGS                "root=/dev/mtdblock1 rw mtdparts=1M(ROM)ro,-(root)"
-
-#define CONFIG_BZIP2           /* Include support for bzip2 compressed images  */
-#undef CONFIG_WATCHDOG         /* Disable platform specific watchdog           */
-
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_LONGHELP                            /* #undef to save memory        */
-#define CONFIG_SYS_CBSIZE              256             /* Console I/O Buffer Size      */
-#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)  /* Print Buffer Size */
-#define CONFIG_SYS_MAXARGS             16              /* Max number of command args   */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size    */
-
-#define CONFIG_SYS_LOAD_ADDR           0x400000        /* Default load address         */
-
-/*-----------------------------------------------------------------------
- * RAM configuration (note that CONFIG_SYS_SDRAM_BASE must be zero)
- */
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_SDRAM_MAX_SIZE      0x01000000      /* Up to 16 Mbyte               */
-
-#define CONFIG_SYS_MAMR                0x00002114
-
-/*
- * 4096        Up to 4096 SDRAM rows
- * 1000        factor s -> ms
- * 32  PTP (pre-divider from MPTPR)
- * 4   Number of refresh cycles per period
- * 64  Refresh cycle in ms per number of rows
- */
-#define CONFIG_SYS_PTA_PER_CLK         ((4096 * 32 * 1000) / (4 * 64))
-
-#define CONFIG_SYS_MEMTEST_START       0x00100000      /* memtest works on             */
-#define CONFIG_SYS_MEMTEST_END         0x00500000      /* 1 ... 5 MB in SDRAM          */
-
-#define CONFIG_SYS_RESET_ADDRESS       0x09900000
-
-/*-----------------------------------------------------------------------
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 256 KB for Monitor   */
-#ifdef CONFIG_BZIP2
-#define CONFIG_SYS_MALLOC_LEN          (2500 << 10)    /* Reserve ~2.5 MB for malloc() */
-#else
-#define CONFIG_SYS_MALLOC_LEN          (128 << 10)     /* Reserve 128 KB for malloc()  */
-#endif /* CONFIG_BZIP2 */
-
-/*-----------------------------------------------------------------------
- * Flash organisation
- */
-#define CONFIG_SYS_FLASH_BASE          0xFE000000
-#define CONFIG_SYS_FLASH_CFI                           /* The flash is CFI compatible  */
-#define CONFIG_FLASH_CFI_DRIVER                        /* Use common CFI driver        */
-#define CONFIG_SYS_MAX_FLASH_BANKS     1               /* Max number of flash banks    */
-#define CONFIG_SYS_MAX_FLASH_SECT      128             /* Max num of sects on one chip */
-
-/* Environment is in flash */
-#define CONFIG_ENV_IS_IN_FLASH
-#define CONFIG_ENV_SECT_SIZE   0x10000         /* We use one complete sector   */
-#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-
-#define CONFIG_ENV_OVERWRITE
-
-#define CONFIG_SYS_OR0_PRELIM          0xFF000774
-#define CONFIG_SYS_BR0_PRELIM          (CONFIG_SYS_FLASH_BASE | BR_PS_16 | BR_MS_GPCM | BR_V)
-
-#define        CONFIG_SYS_DIRECT_FLASH_TFTP
-
-/*-----------------------------------------------------------------------
- * Internal Memory Map Register
- */
-#define CONFIG_SYS_IMMR                0xFF000000
-
-/*-----------------------------------------------------------------------
- * Definitions for initial stack pointer and data area (in DPRAM)
- */
-#define CONFIG_SYS_INIT_RAM_ADDR       CONFIG_SYS_IMMR
-#define CONFIG_SYS_INIT_RAM_SIZE       0x2F00          /* Size of used area in DPRAM   */
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-
-/*-----------------------------------------------------------------------
- * Configuration registers
- */
-#ifdef CONFIG_WATCHDOG
-#define CONFIG_SYS_SYPCR               (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME  | \
-                                SYPCR_SWF  | SYPCR_SWE | SYPCR_SWRI | \
-                                SYPCR_SWP)
-#else
-#define CONFIG_SYS_SYPCR               (SYPCR_SWTC | SYPCR_BMT | SYPCR_BME  | \
-                                SYPCR_SWF  | SYPCR_SWP)
-#endif /* CONFIG_WATCHDOG */
-
-#define CONFIG_SYS_SIUMCR              (SIUMCR_MLRC01 | SIUMCR_DBGC11)
-
-/* TBSCR - Time Base Status and Control Register */
-#define CONFIG_SYS_TBSCR               (TBSCR_TBF | TBSCR_TBE)
-
-/* PISCR - Periodic Interrupt Status and Control */
-#define CONFIG_SYS_PISCR               (PISCR_PS | PISCR_PITF)
-
-/* PLPRCR - PLL, Low-Power, and Reset Control Register */
-/* #define CONFIG_SYS_PLPRCR           PLPRCR_TEXPS */
-
-/* SCCR - System Clock and reset Control Register */
-#define SCCR_MASK              SCCR_EBDF11
-#define CONFIG_SYS_SCCR                SCCR_RTSEL
-
-#define CONFIG_SYS_DER                 0
-
-/*-----------------------------------------------------------------------
- * Cache Configuration
- */
-#define CONFIG_SYS_CACHELINE_SIZE      16      /* For all MPC8xx chips                 */
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
-#endif /* __CONFIG_H */
diff --git a/include/configs/HIDDEN_DRAGON.h b/include/configs/HIDDEN_DRAGON.h
deleted file mode 100644 (file)
index e0a233b..0000000
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * (C) Copyright 2004
- * Yusdi Santoso, Adaptec Inc., yusdi_santoso@adaptec.com
- *
- * (C) Copyright 2001, 2002
- * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * board/config.h - configuration options, board specific
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-/*
- * High Level Configuration Options
- * (easy to change)
- */
-
-#define CONFIG_MPC8245         1
-#define CONFIG_HIDDEN_DRAGON   1
-
-#define        CONFIG_SYS_TEXT_BASE    0xFFF00000
-
-#if 0
-#define USE_DINK32             1
-#else
-#undef USE_DINK32
-#endif
-
-#define CONFIG_CONS_INDEX      3               /* set to '3' for on-chip DUART */
-#define CONFIG_BAUDRATE                9600
-#define CONFIG_DRAM_SPEED      100             /* MHz                          */
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_NET
-#define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_LONGHELP            1               /* undef to save memory         */
-#define CONFIG_SYS_CBSIZE              256             /* Console I/O Buffer Size      */
-#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)     /* Print Buffer Size    */
-#define CONFIG_SYS_MAXARGS             16              /* max number of command args   */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size    */
-#define CONFIG_SYS_LOAD_ADDR           0x00100000      /* default load address         */
-
-/*-----------------------------------------------------------------------
- * PCI stuff
- *-----------------------------------------------------------------------
- */
-#define CONFIG_PCI                             /* include pci support          */
-#define CONFIG_PCI_INDIRECT_BRIDGE     /* indirect PCI bridge support */
-#undef CONFIG_PCI_PNP
-
-
-#define CONFIG_SYS_RX_ETH_BUFFER       8               /* use 8 rx buffer on eepro100  */
-
-#define PCI_ENET0_IOADDR       0x80000000
-#define PCI_ENET0_MEMADDR      0x80000000
-#define PCI_ENET1_IOADDR       0x81000000
-#define PCI_ENET1_MEMADDR      0x81000000
-
-#define CONFIG_RTL8139
-
-/* Make sure the ethaddr can be overwritten
-   TODO: Remove this on final product
-*/
-#define CONFIG_ENV_OVERWRITE
-
-/*-----------------------------------------------------------------------
- * Start addresses for the final memory configuration
- * (Set up by the startup code)
- * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0
- */
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_MAX_RAM_SIZE        0x02000000
-
-#define CONFIG_SYS_RESET_ADDRESS       0xFFF00100
-
-#if defined (USE_DINK32)
-#define CONFIG_SYS_MONITOR_LEN         0x00030000
-#define CONFIG_SYS_MONITOR_BASE        0x00090000
-#define CONFIG_SYS_RAMBOOT             1
-#define CONFIG_SYS_INIT_RAM_ADDR       (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#define CONFIG_SYS_INIT_RAM_SIZE       0x10000
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-#else
-#undef CONFIG_SYS_RAMBOOT
-#define CONFIG_SYS_MONITOR_LEN         0x00030000
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-
-
-#define CONFIG_SYS_INIT_RAM_ADDR     0x40000000
-#define CONFIG_SYS_INIT_RAM_SIZE      0x1000
-#define CONFIG_SYS_GBL_DATA_OFFSET  (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-
-#endif
-
-#define CONFIG_SYS_FLASH_BASE          0xFFE00000
-#define CONFIG_SYS_FLASH_SIZE          (2 * 1024 * 1024)       /* Unity has onboard 1MByte flash */
-#define CONFIG_ENV_IS_IN_FLASH 1
-#define CONFIG_ENV_OFFSET              0x00004000      /* Offset of Environment Sector */
-#define CONFIG_ENV_SIZE                0x00002000      /* Total Size of Environment Sector */
-
-#define CONFIG_SYS_MALLOC_LEN          (512 << 10)     /* Reserve 512 kB for malloc()  */
-
-#define CONFIG_SYS_MEMTEST_START       0x00000000      /* memtest works on             */
-#define CONFIG_SYS_MEMTEST_END         0x02000000      /* 0 ... 32 MB in DRAM          */
-
-#define CONFIG_SYS_EUMB_ADDR           0xFC000000
-
-#define CONFIG_SYS_ISA_MEM             0xFD000000
-#define CONFIG_SYS_ISA_IO              0xFE000000
-
-#define CONFIG_SYS_FLASH_RANGE_BASE    0xFFE00000      /* flash memory address range   */
-#define CONFIG_SYS_FLASH_RANGE_SIZE    0x00200000
-#define FLASH_BASE0_PRELIM     0xFFE00000      /* processor board flash        */
-
-/*
- * select i2c support configuration
- *
- * Supported configurations are {none, software, hardware} drivers.
- * If the software driver is chosen, there are some additional
- * configuration items that the driver uses to drive the port pins.
- */
-#define CONFIG_HARD_I2C                1               /* To enable I2C support        */
-#undef CONFIG_SYS_I2C_SOFT                     /* I2C bit-banged */
-#define CONFIG_SYS_I2C_SPEED           400000          /* I2C speed and slave address  */
-#define CONFIG_SYS_I2C_SLAVE           0x7F
-
-#ifdef CONFIG_SYS_I2C_SOFT
-#error "Soft I2C is not configured properly.  Please review!"
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_SOFT_SPEED      50000
-#define CONFIG_SYS_I2C_SOFT_SLAVE      0xFE
-#define I2C_PORT               3               /* Port A=0, B=1, C=2, D=3 */
-#define I2C_ACTIVE             (iop->pdir |=  0x00010000)
-#define I2C_TRISTATE           (iop->pdir &= ~0x00010000)
-#define I2C_READ               ((iop->pdat & 0x00010000) != 0)
-#define I2C_SDA(bit)           if(bit) iop->pdat |=  0x00010000; \
-                               else    iop->pdat &= ~0x00010000
-#define I2C_SCL(bit)           if(bit) iop->pdat |=  0x00020000; \
-                               else    iop->pdat &= ~0x00020000
-#define I2C_DELAY              udelay(5)       /* 1/4 I2C clock duration */
-#endif /* CONFIG_SYS_I2C_SOFT */
-
-#define CONFIG_SYS_I2C_EEPROM_ADDR     0x57            /* EEPROM IS24C02               */
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1               /* Bytes of address             */
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      3
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10      /* and takes up to 10 msec */
-
-#define CONFIG_SYS_FLASH_BANKS         { FLASH_BASE0_PRELIM }
-
-/*-----------------------------------------------------------------------
- * Definitions for initial stack pointer and data area (in DPRAM)
- */
-
-
-/* #define CONFIG_WINBOND_83C553       1       / *has a winbond bridge                 */
-#define CONFIG_SYS_USE_WINBOND_IDE     0       /*use winbond 83c553 internal IDE ctrlr */
-#define CONFIG_SYS_WINBOND_ISA_CFG_ADDR    0x80005800  /*pci-isa bridge config addr    */
-#define CONFIG_SYS_WINBOND_IDE_CFG_ADDR    0x80005900  /*ide config addr               */
-
-#define CONFIG_SYS_IDE_MAXBUS          2   /* max. 2 IDE busses        */
-#define CONFIG_SYS_IDE_MAXDEVICE       (CONFIG_SYS_IDE_MAXBUS*2) /* max. 2 drives per IDE bus */
-
-/* TODO: Change this to VIA686A */
-
-/*
- * NS87308 Configuration
- */
-#define CONFIG_NS87308                 /* Nat Semi super-io controller on ISA bus */
-
-#define CONFIG_SYS_NS87308_BADDR_10    1
-
-#define CONFIG_SYS_NS87308_DEVS        ( CONFIG_SYS_NS87308_UART1   | \
-                                 CONFIG_SYS_NS87308_UART2   | \
-                                 CONFIG_SYS_NS87308_POWRMAN | \
-                                 CONFIG_SYS_NS87308_RTC_APC )
-
-#undef CONFIG_SYS_NS87308_PS2MOD
-
-#define CONFIG_SYS_NS87308_CS0_BASE    0x0076
-#define CONFIG_SYS_NS87308_CS0_CONF    0x30
-#define CONFIG_SYS_NS87308_CS1_BASE    0x0075
-#define CONFIG_SYS_NS87308_CS1_CONF    0x30
-#define CONFIG_SYS_NS87308_CS2_BASE    0x0074
-#define CONFIG_SYS_NS87308_CS2_CONF    0x30
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-
-#define CONFIG_SYS_NS16550_REG_SIZE    1
-
-#if (CONFIG_CONS_INDEX > 2)
-#define CONFIG_SYS_NS16550_CLK         CONFIG_DRAM_SPEED*1000000
-#else
-#define CONFIG_SYS_NS16550_CLK         1843200
-#endif
-
-#define CONFIG_SYS_NS16550_COM1        (CONFIG_SYS_ISA_IO + CONFIG_SYS_NS87308_UART1_BASE)
-#define CONFIG_SYS_NS16550_COM2        (CONFIG_SYS_ISA_IO + CONFIG_SYS_NS87308_UART2_BASE)
-#define CONFIG_SYS_NS16550_COM3        (CONFIG_SYS_EUMB_ADDR + 0x4500)
-#define CONFIG_SYS_NS16550_COM4        (CONFIG_SYS_EUMB_ADDR + 0x4600)
-
-/*
- * 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_CLK_FREQ  33333333  /* external frequency to pll */
-
-#define CONFIG_SYS_ROMNAL              7       /*rom/flash next access time            */
-#define CONFIG_SYS_ROMFAL              11      /*rom/flash access time                 */
-
-#define CONFIG_SYS_REFINT      430     /* no of clock cycles between CBR refresh cycles */
-
-/* the following are for SDRAM only*/
-#define CONFIG_SYS_BSTOPRE     121     /* Burst To Precharge, sets open page interval */
-#define CONFIG_SYS_REFREC              8       /* Refresh to activate interval         */
-#define CONFIG_SYS_RDLAT               4       /* data latency from read command       */
-#define CONFIG_SYS_PRETOACT            3       /* Precharge to activate interval       */
-#define CONFIG_SYS_ACTTOPRE            5       /* Activate to Precharge interval       */
-#define CONFIG_SYS_ACTORW              3       /* Activate to R/W                      */
-#define CONFIG_SYS_SDMODE_CAS_LAT      3       /* SDMODE CAS latency                   */
-#define CONFIG_SYS_SDMODE_WRAP         0       /* SDMODE wrap type                     */
-#if 0
-#define CONFIG_SYS_SDMODE_BURSTLEN     2       /* OBSOLETE!  SDMODE Burst length 2=4, 3=8              */
-#endif
-
-#define CONFIG_SYS_REGISTERD_TYPE_BUFFER   1
-#define CONFIG_SYS_EXTROM 1
-#define CONFIG_SYS_REGDIMM 0
-
-
-/* memory bank settings*/
-/*
- * only bits 20-29 are actually used from these vales to set the
- * start/end address the upper two bits will be 0, and the lower 20
- * bits will be set to 0x00000 for a start address, or 0xfffff for an
- * end address
- */
-#define CONFIG_SYS_BANK0_START         0x00000000
-#define CONFIG_SYS_BANK0_END           (CONFIG_SYS_MAX_RAM_SIZE - 1)
-#define CONFIG_SYS_BANK0_ENABLE        1
-#define CONFIG_SYS_BANK1_START         0x3ff00000
-#define CONFIG_SYS_BANK1_END           0x3fffffff
-#define CONFIG_SYS_BANK1_ENABLE        0
-#define CONFIG_SYS_BANK2_START         0x3ff00000
-#define CONFIG_SYS_BANK2_END           0x3fffffff
-#define CONFIG_SYS_BANK2_ENABLE        0
-#define CONFIG_SYS_BANK3_START         0x3ff00000
-#define CONFIG_SYS_BANK3_END           0x3fffffff
-#define CONFIG_SYS_BANK3_ENABLE        0
-#define CONFIG_SYS_BANK4_START         0x00000000
-#define CONFIG_SYS_BANK4_END           0x00000000
-#define CONFIG_SYS_BANK4_ENABLE        0
-#define CONFIG_SYS_BANK5_START         0x00000000
-#define CONFIG_SYS_BANK5_END           0x00000000
-#define CONFIG_SYS_BANK5_ENABLE        0
-#define CONFIG_SYS_BANK6_START         0x00000000
-#define CONFIG_SYS_BANK6_END           0x00000000
-#define CONFIG_SYS_BANK6_ENABLE        0
-#define CONFIG_SYS_BANK7_START         0x00000000
-#define CONFIG_SYS_BANK7_END           0x00000000
-#define CONFIG_SYS_BANK7_ENABLE        0
-/*
- * Memory bank enable bitmask, specifying which of the banks defined above
- are actually present. MSB is for bank #7, LSB is for bank #0.
- */
-#define CONFIG_SYS_BANK_ENABLE         0x01
-
-#define CONFIG_SYS_ODCR                0xff    /* configures line driver impedances,   */
-                                       /* see 8240 book for bit definitions    */
-#define CONFIG_SYS_PGMAX               0x32    /* how long the 8240 retains the        */
-                                       /* currently accessed page in memory    */
-                                       /* see 8240 book for details            */
-
-/* SDRAM 0 - 256MB */
-#define CONFIG_SYS_IBAT0L      (CONFIG_SYS_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
-#define CONFIG_SYS_IBAT0U      (CONFIG_SYS_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
-
-/* stack in DCACHE @ 1GB (no backing mem) */
-#if defined(USE_DINK32)
-#define CONFIG_SYS_IBAT1L      (0x40000000 | BATL_PP_00 )
-#define CONFIG_SYS_IBAT1U      (0x40000000 | BATU_BL_128K )
-#else
-#define CONFIG_SYS_IBAT1L      (CONFIG_SYS_INIT_RAM_ADDR | BATL_PP_10 | BATL_MEMCOHERENCE)
-#define CONFIG_SYS_IBAT1U      (CONFIG_SYS_INIT_RAM_ADDR | BATU_BL_128K | BATU_VS | BATU_VP)
-#endif
-
-/* PCI memory */
-#define CONFIG_SYS_IBAT2L      (0x80000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
-#define CONFIG_SYS_IBAT2U      (0x80000000 | BATU_BL_256M | BATU_VS | BATU_VP)
-
-/* Flash, config addrs, etc */
-#define CONFIG_SYS_IBAT3L      (0xF0000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
-#define CONFIG_SYS_IBAT3U      (0xF0000000 | BATU_BL_256M | BATU_VS | BATU_VP)
-
-#define CONFIG_SYS_DBAT0L      CONFIG_SYS_IBAT0L
-#define CONFIG_SYS_DBAT0U      CONFIG_SYS_IBAT0U
-#define CONFIG_SYS_DBAT1L      CONFIG_SYS_IBAT1L
-#define CONFIG_SYS_DBAT1U      CONFIG_SYS_IBAT1U
-#define CONFIG_SYS_DBAT2L      CONFIG_SYS_IBAT2L
-#define CONFIG_SYS_DBAT2U      CONFIG_SYS_IBAT2U
-#define CONFIG_SYS_DBAT3L      CONFIG_SYS_IBAT3L
-#define CONFIG_SYS_DBAT3U      CONFIG_SYS_IBAT3U
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-/*-----------------------------------------------------------------------
- * FLASH organization
- */
-#define CONFIG_SYS_MAX_FLASH_BANKS     1       /* max number of memory banks           */
-#define CONFIG_SYS_MAX_FLASH_SECT      36      /* max number of sectors on one chip    */
-
-#define CONFIG_SYS_FLASH_ERASE_TOUT    120000  /* Timeout for Flash Erase (in ms)      */
-#define CONFIG_SYS_FLASH_WRITE_TOUT    500     /* Timeout for Flash Write (in ms)      */
-
-/*-----------------------------------------------------------------------
- * Cache Configuration
- */
-#define CONFIG_SYS_CACHELINE_SIZE      32      /* For MPC8240 CPU                      */
-#if defined(CONFIG_CMD_KGDB)
-#  define CONFIG_SYS_CACHELINE_SHIFT   5       /* log base 2 of the above value */
-#endif
-
-/* values according to the manual */
-#define CONFIG_DRAM_50MHZ      1
-#define CONFIG_SDRAM_50MHZ
-
-#undef NR_8259_INTS
-#define NR_8259_INTS           1
-
-#define CONFIG_DISK_SPINUP_TIME 1000000
-
-#endif /* __CONFIG_H */
diff --git a/include/configs/ISPAN.h b/include/configs/ISPAN.h
deleted file mode 100644 (file)
index a2fdfd3..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
- * Copyright (C) 2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * Support for Interphase iSPAN Communications Controllers
- * (453x and others). Tested on 4532.
- *
- * Derived from iSPAN 4539 port (iphase4539) by
- * Wolfgang Grandegger <wg@denx.de>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define CONFIG_ISPAN                   /* ...on one of Interphase iSPAN boards */
-#define CONFIG_CPM2            1       /* Has a CPM2 */
-
-#define        CONFIG_SYS_TEXT_BASE    0xFE7A0000
-
-/*-----------------------------------------------------------------------
- * Select serial console configuration
- *
- * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
- * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
- * for SCC).
- *
- * If CONFIG_CONS_NONE is defined, then the serial console routines must be
- * defined elsewhere (for example, on the cogent platform, there are serial
- * ports on the motherboard which are used for the serial console - see
- * cogent/cma101/serial.[ch]).
- */
-#define        CONFIG_CONS_ON_SMC              /* Define if console on SMC             */
-#undef CONFIG_CONS_ON_SCC              /* Define if console on SCC             */
-#undef CONFIG_CONS_NONE                /* Define if console on something else  */
-#define CONFIG_CONS_INDEX      1       /* Which serial channel for console     */
-
-/*-----------------------------------------------------------------------
- * Select Ethernet configuration
- *
- * If either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected, then
- * CONFIG_ETHER_INDEX must be set to the channel number (1-4 for SCC, 1-3
- * for FCC).
- *
- * If CONFIG_ETHER_NONE is defined, then either the Ethernet routines must
- * be defined elsewhere (as for the console), or CONFIG_CMD_NET must be unset.
- */
-#undef CONFIG_ETHER_ON_SCC             /* Define if Ethernet on SCC            */
-#define CONFIG_ETHER_ON_FCC            /* Define if Ethernet on FCC            */
-#undef CONFIG_ETHER_NONE               /* Define if Ethernet on something else */
-#define CONFIG_ETHER_INDEX     3       /* Which channel for Ethernrt           */
-
-#ifdef CONFIG_ETHER_ON_FCC
-
-#if CONFIG_ETHER_INDEX == 3
-
-#define CONFIG_SYS_PHY_ADDR            0
-#define CONFIG_SYS_CMXFCR_VALUE3       (CMXFCR_RF3CS_CLK14 | CMXFCR_TF3CS_CLK16)
-#define CONFIG_SYS_CMXFCR_MASK3                (CMXFCR_FC3 | CMXFCR_RF3CS_MSK | CMXFCR_TF3CS_MSK)
-
-#endif /* CONFIG_ETHER_INDEX == 3 */
-
-#define CONFIG_SYS_CPMFCR_RAMTYPE      0
-#define CONFIG_SYS_FCC_PSMR            (FCC_PSMR_FDE | FCC_PSMR_LPB)
-
-#define CONFIG_MII                             /* MII PHY management           */
-#define CONFIG_BITBANGMII                      /* Bit-bang MII PHY management  */
-/*
- * GPIO pins used for bit-banged MII communications
- */
-#define MDIO_PORT              3               /* Port D */
-#define MDIO_DECLARE           volatile ioport_t *iop = ioport_addr ( \
-                                       (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
-#define MDC_DECLARE            MDIO_DECLARE
-
-
-#define CONFIG_SYS_MDIO_PIN            0x00040000      /* PD13 */
-#define CONFIG_SYS_MDC_PIN             0x00080000      /* PD12 */
-
-#define MDIO_ACTIVE            (iop->pdir |=  CONFIG_SYS_MDIO_PIN)
-#define MDIO_TRISTATE          (iop->pdir &= ~CONFIG_SYS_MDIO_PIN)
-#define MDIO_READ              ((iop->pdat &  CONFIG_SYS_MDIO_PIN) != 0)
-
-#define MDIO(bit)              if(bit) iop->pdat |=  CONFIG_SYS_MDIO_PIN; \
-                               else    iop->pdat &= ~CONFIG_SYS_MDIO_PIN
-
-#define MDC(bit)               if(bit) iop->pdat |=  CONFIG_SYS_MDC_PIN; \
-                               else    iop->pdat &= ~CONFIG_SYS_MDC_PIN
-
-#define MIIDELAY               udelay(1)
-
-#endif /* CONFIG_ETHER_ON_FCC */
-
-#define CONFIG_8260_CLKIN      65536000        /* in Hz */
-#define CONFIG_BAUDRATE                38400
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_IMMAP
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
-
-
-#define CONFIG_BOOTDELAY       5               /* autoboot after 5 seconds     */
-#define CONFIG_BOOTCOMMAND     "bootm fe010000"        /* autoboot command     */
-#define CONFIG_BOOTARGS                "root=/dev/ram rw"
-
-#define CONFIG_BZIP2           /* Include support for bzip2 compressed images  */
-#undef CONFIG_WATCHDOG         /* Disable platform specific watchdog           */
-
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_LONGHELP                            /* #undef to save memory        */
-#define CONFIG_SYS_CBSIZE              256             /* Console I/O Buffer Size      */
-#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)  /* Print Buffer Size */
-#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       0x00100000      /* memtest works on             */
-#define CONFIG_SYS_MEMTEST_END         0x03B00000      /* 1 ... 59 MB in SDRAM         */
-
-#define CONFIG_SYS_LOAD_ADDR           0x100000        /* Default load address         */
-
-#define CONFIG_SYS_RESET_ADDRESS       0x09900000
-
-#define CONFIG_MISC_INIT_R                     /* We need misc_init_r()        */
-
-/*-----------------------------------------------------------------------
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_MONITOR_LEN         (192 << 10)     /* Reserve 192 kB for Monitor   */
-#ifdef CONFIG_BZIP2
-#define CONFIG_SYS_MALLOC_LEN          (4096 << 10)    /* Reserve 4 MB for malloc()    */
-#else
-#define CONFIG_SYS_MALLOC_LEN          (128 << 10)     /* Reserve 128 KB for malloc()  */
-#endif /* CONFIG_BZIP2 */
-
-/*-----------------------------------------------------------------------
- * FLASH organization
- */
-#define CONFIG_SYS_FLASH_BASE          0xFE000000
-#define CONFIG_SYS_FLASH_CFI                           /* The flash is CFI compatible  */
-#define CONFIG_FLASH_CFI_DRIVER                        /* Use common CFI driver        */
-#define CONFIG_SYS_MAX_FLASH_BANKS     1               /* Max num of memory banks      */
-#define CONFIG_SYS_MAX_FLASH_SECT      142             /* Max num of sects on one chip */
-
-/* Environment is in flash, there is little space left in Serial EEPROM */
-#define CONFIG_ENV_IS_IN_FLASH
-#define CONFIG_ENV_SECT_SIZE   0x10000         /* We use one complete sector   */
-#define CONFIG_ENV_SIZE                (CONFIG_ENV_SECT_SIZE)
-#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
-#define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
-
-/*-----------------------------------------------------------------------
- * Hard Reset Configuration Words
- *
- * If you change bits in the HRCW, you must also change the CONFIG_SYS_*
- * defines for the various registers affected by the HRCW e.g. changing
- * HRCW_DPPCxx requires you to also change CONFIG_SYS_SIUMCR.
- */
-/* 0x1686B245 */
-#define CONFIG_SYS_HRCW_MASTER (HRCW_EBM      | HRCW_BPS01       | HRCW_CIP    |\
-                        HRCW_L2CPC10  | HRCW_ISB110                    |\
-                        HRCW_BMS      | HRCW_MMR11       | HRCW_APPC10 |\
-                        HRCW_CS10PC01 | HRCW_MODCK_H0101                \
-                       )
-/* No slaves */
-#define CONFIG_SYS_HRCW_SLAVE1 0
-#define CONFIG_SYS_HRCW_SLAVE2 0
-#define CONFIG_SYS_HRCW_SLAVE3 0
-#define CONFIG_SYS_HRCW_SLAVE4 0
-#define CONFIG_SYS_HRCW_SLAVE5 0
-#define CONFIG_SYS_HRCW_SLAVE6 0
-#define CONFIG_SYS_HRCW_SLAVE7 0
-
-/*-----------------------------------------------------------------------
- * Internal Memory Mapped Register
- */
-#define CONFIG_SYS_IMMR                0xF0F00000
-#ifdef CONFIG_SYS_REV_B
-#define CONFIG_SYS_DEFAULT_IMMR        0xFF000000
-#endif /* CONFIG_SYS_REV_B */
-/*-----------------------------------------------------------------------
- * Definitions for initial stack pointer and data area (in DPRAM)
- */
-#define CONFIG_SYS_INIT_RAM_ADDR       CONFIG_SYS_IMMR
-#define CONFIG_SYS_INIT_RAM_SIZE       0x4000          /* Size of used area in DPRAM   */
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-
-/*-----------------------------------------------------------------------
- * Cache Configuration
- */
-#define CONFIG_SYS_CACHELINE_SIZE      32      /* For MPC8260 CPU                      */
-
-/*-----------------------------------------------------------------------
- * HIDx - Hardware Implementation-dependent Registers          2-11
- *-----------------------------------------------------------------------
- * HID0 also contains cache control.
- *
- * HID1 has only read-only information - nothing to set.
- */
-#define CONFIG_SYS_HID0_INIT           (HID0_ICE|HID0_DCE|HID0_ICFI|HID0_DCI|\
-                               HID0_IFEM|HID0_ABE)
-#define CONFIG_SYS_HID0_FINAL          (HID0_ICE|HID0_IFEM|HID0_ABE)
-#define CONFIG_SYS_HID2                0
-
-/*-----------------------------------------------------------------------
- * RMR - Reset Mode Register                                    5-5
- *-----------------------------------------------------------------------
- * turn on Checkstop Reset Enable
- */
-#define CONFIG_SYS_RMR                 RMR_CSRE
-
-/*-----------------------------------------------------------------------
- * BCR - Bus Configuration                                      4-25
- *-----------------------------------------------------------------------
- */
-#define CONFIG_SYS_BCR                 0xA01C0000
-
-/*-----------------------------------------------------------------------
- * SIUMCR - SIU Module Configuration                            4-31
- *-----------------------------------------------------------------------
- */
-#define CONFIG_SYS_SIUMCR              0x42250000/* 0x4205C000 */
-
-/*-----------------------------------------------------------------------
- * SYPCR - System Protection Control                            4-35
- * SYPCR can only be written once after reset!
- *-----------------------------------------------------------------------
- * Watchdog & Bus Monitor Timer max, 60x Bus Monitor enable
- */
-#if defined (CONFIG_WATCHDOG)
-#define CONFIG_SYS_SYPCR               (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
-                               SYPCR_SWRI|SYPCR_SWP|SYPCR_SWE)
-#else
-#define CONFIG_SYS_SYPCR               (SYPCR_SWTC|SYPCR_BMT|SYPCR_PBME|SYPCR_LBME|\
-                               SYPCR_SWRI|SYPCR_SWP)
-#endif /* CONFIG_WATCHDOG */
-
-/*-----------------------------------------------------------------------
- * TMCNTSC - Time Counter Status and Control                    4-40
- * Clear once per Second and Alarm Interrupt Status, Set 32KHz timersclk,
- * and enable Time Counter
- *-----------------------------------------------------------------------
- */
-#define CONFIG_SYS_TMCNTSC             (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
-
-/*-----------------------------------------------------------------------
- * PISCR - Periodic Interrupt Status and Control                4-42
- *-----------------------------------------------------------------------
- * Clear Periodic Interrupt Status, Set 32KHz timersclk, and enable
- * Periodic timer
- */
-#define CONFIG_SYS_PISCR               (PISCR_PS|PISCR_PTF|PISCR_PTE)
-
-/*-----------------------------------------------------------------------
- * SCCR - System Clock Control                                  9-8
- *-----------------------------------------------------------------------
- * Ensure DFBRG is Divide by 16
- */
-#define CONFIG_SYS_SCCR                SCCR_DFBRG01
-
-/*-----------------------------------------------------------------------
- * RCCR - RISC Controller Configuration                                13-7
- *-----------------------------------------------------------------------
- */
-#define CONFIG_SYS_RCCR                0
-
-/*-----------------------------------------------------------------------
- * Init Memory Controller:
- *
- * Bank Bus    Machine PortSize                        Device
- * ---- ---    ------- -----------------------------   ------
- *  0  60x     GPCM     8 bit (Rev.B)/16 bit (Rev.D)   Flash
- *  1  60x     SDRAM   64 bit                          SDRAM
- *  2  Local   SDRAM   32 bit                          SDRAM
- */
-#define CONFIG_SYS_USE_FIRMWARE        /* If defined - do not initialise memory
-                                  controller, rely on initialisation
-                                  performed by the Interphase boot firmware.
-                                */
-
-#define CONFIG_SYS_OR0_PRELIM          0xFE000882
-#ifdef CONFIG_SYS_REV_B
-#define CONFIG_SYS_BR0_PRELIM          (CONFIG_SYS_FLASH_BASE | BRx_PS_8  | BRx_V)
-#else  /* Rev. D */
-#define CONFIG_SYS_BR0_PRELIM          (CONFIG_SYS_FLASH_BASE | BRx_PS_16 | BRx_V)
-#endif /* CONFIG_SYS_REV_B */
-
-#define CONFIG_SYS_MPTPR               0x7F00
-
-/* Please note that 60x SDRAM MUST start at 0 */
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_60x_BR              0x00000041
-#define CONFIG_SYS_60x_OR              0xF0002CD0
-#define CONFIG_SYS_PSDMR               0x0049929A
-#define CONFIG_SYS_PSRT                0x07
-
-#define CONFIG_SYS_LSDRAM_BASE         0xF7000000
-#define CONFIG_SYS_LOC_BR              0x00001861
-#define CONFIG_SYS_LOC_OR              0xFF803280
-#define CONFIG_SYS_LSDMR               0x8285A552
-#define CONFIG_SYS_LSRT                0x07
-
-#endif /* __CONFIG_H */
diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h
deleted file mode 100644 (file)
index 39f7564..0000000
+++ /dev/null
@@ -1,549 +0,0 @@
-/*
- * (C) Copyright 2001
- * Stuart Hughes <stuarth@lineo.com>
- * This file is based on similar values for other boards found in other
- * U-Boot config files, and some that I found in the mpc8260ads manual.
- *
- * Note: my board is a PILOT rev.
- * Note: the mpc8260ads doesn't come with a proper Ethernet MAC address.
- *
- * (C) Copyright 2003-2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- * Added support for SDRAM DIMMs SPD EEPROM, MII, JFFS2.
- * Ported to PQ2FADS-ZU and PQ2FADS-VR boards.
- * Ported to MPC8272ADS board.
- *
- * Copyright (c) 2005 MontaVista Software, Inc.
- * Vitaly Bordug <vbordug@ru.mvista.com>
- * Added support for PCI bridge on MPC8272ADS
- *
- * Copyright (C) Freescale Semiconductor, Inc. 2006-2009.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-/*
- * High Level Configuration Options
- * (easy to change)
- */
-
-#define CONFIG_MPC8260ADS      1       /* Motorola PQ2 ADS family board */
-
-#ifndef CONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_TEXT_BASE   0xFFF00000      /* Standard: boot high */
-#endif
-
-#define CONFIG_CPM2            1       /* Has a CPM2 */
-
-/*
- * Figure out if we are booting low via flash HRCW or high via the BCSR.
- */
-#if (CONFIG_SYS_TEXT_BASE != 0xFFF00000)               /* Boot low (flash HRCW) */
-#   define CONFIG_SYS_LOWBOOT          1
-#endif
-
-/* ADS flavours */
-#define CONFIG_SYS_8260ADS             1       /* MPC8260ADS */
-#define CONFIG_SYS_8266ADS             2       /* MPC8266ADS */
-#define CONFIG_SYS_PQ2FADS             3       /* PQ2FADS-ZU or PQ2FADS-VR */
-#define CONFIG_SYS_8272ADS             4       /* MPC8272ADS */
-
-#ifndef CONFIG_ADSTYPE
-#define CONFIG_ADSTYPE         CONFIG_SYS_8260ADS
-#endif /* CONFIG_ADSTYPE */
-
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-#define CONFIG_MPC8272         1
-#elif CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS
-/*
- * Actually MPC8275, but the code is littered with ifdefs that
- * apply to both, or which use this ifdef to assume board-specific
- * details. :-(
- */
-#define CONFIG_MPC8272         1
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_8272ADS */
-
-#define CONFIG_BOARD_EARLY_INIT_F 1    /* Call board_early_init_f      */
-#define CONFIG_RESET_PHY_R     1       /* Call reset_phy()             */
-
-/* allow serial and ethaddr to be overwritten */
-#define CONFIG_ENV_OVERWRITE
-
-/*
- * select serial console configuration
- *
- * if either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
- * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
- * for SCC).
- *
- * if CONFIG_CONS_NONE is defined, then the serial console routines must
- * defined elsewhere (for example, on the cogent platform, there are serial
- * ports on the motherboard which are used for the serial console - see
- * cogent/cma101/serial.[ch]).
- */
-#undef CONFIG_CONS_ON_SMC              /* define if console on SMC */
-#define CONFIG_CONS_ON_SCC             /* define if console on SCC */
-#undef CONFIG_CONS_NONE                /* define if console on something else */
-#define CONFIG_CONS_INDEX      1       /* which serial channel for console */
-
-/*
- * select ethernet configuration
- *
- * if either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected, then
- * CONFIG_ETHER_INDEX must be set to the channel number (1-4 for SCC, 1-3
- * for FCC)
- *
- * if CONFIG_ETHER_NONE is defined, then either the ethernet routines must be
- * defined elsewhere (as for the console), or CONFIG_CMD_NET must be unset.
- */
-#undef CONFIG_ETHER_ON_SCC             /* define if ether on SCC   */
-#define CONFIG_ETHER_ON_FCC            /* define if ether on FCC   */
-#undef CONFIG_ETHER_NONE               /* define if ether on something else */
-
-#ifdef CONFIG_ETHER_ON_FCC
-
-#define CONFIG_ETHER_INDEX     2       /* which SCC/FCC channel for ethernet */
-
-#if   CONFIG_ETHER_INDEX == 1
-
-# define CONFIG_SYS_PHY_ADDR           0
-# define CONFIG_SYS_CMXFCR_VALUE1      (CMXFCR_RF1CS_CLK11 | CMXFCR_TF1CS_CLK10)
-# define CONFIG_SYS_CMXFCR_MASK1       (CMXFCR_FC1 | CMXFCR_RF1CS_MSK | CMXFCR_TF1CS_MSK)
-
-#elif CONFIG_ETHER_INDEX == 2
-
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS       /* RxCLK is CLK15, TxCLK is CLK16 */
-# define CONFIG_SYS_PHY_ADDR           3
-# define CONFIG_SYS_CMXFCR_VALUE2      (CMXFCR_RF2CS_CLK15 | CMXFCR_TF2CS_CLK16)
-#else                                  /* RxCLK is CLK13, TxCLK is CLK14 */
-# define CONFIG_SYS_PHY_ADDR           0
-# define CONFIG_SYS_CMXFCR_VALUE2      (CMXFCR_RF2CS_CLK13 | CMXFCR_TF2CS_CLK14)
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_8272ADS */
-
-# define CONFIG_SYS_CMXFCR_MASK2       (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
-
-#endif /* CONFIG_ETHER_INDEX */
-
-#define CONFIG_SYS_CPMFCR_RAMTYPE      0               /* BDs and buffers on 60x bus */
-#define CONFIG_SYS_FCC_PSMR            (FCC_PSMR_FDE | FCC_PSMR_LPB)  /* Full duplex */
-
-#define CONFIG_MII                     /* MII PHY management           */
-#define CONFIG_BITBANGMII              /* bit-bang MII PHY management  */
-/*
- * GPIO pins used for bit-banged MII communications
- */
-#define MDIO_PORT      2               /* Port C */
-#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ( \
-                               (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
-#define MDC_DECLARE    MDIO_DECLARE
-
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-#define CONFIG_SYS_MDIO_PIN    0x00002000      /* PC18 */
-#define CONFIG_SYS_MDC_PIN     0x00001000      /* PC19 */
-#else
-#define CONFIG_SYS_MDIO_PIN    0x00400000      /* PC9  */
-#define CONFIG_SYS_MDC_PIN     0x00200000      /* PC10 */
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_8272ADS */
-
-#define MDIO_ACTIVE    (iop->pdir |=  CONFIG_SYS_MDIO_PIN)
-#define MDIO_TRISTATE  (iop->pdir &= ~CONFIG_SYS_MDIO_PIN)
-#define MDIO_READ      ((iop->pdat &  CONFIG_SYS_MDIO_PIN) != 0)
-
-#define MDIO(bit)      if(bit) iop->pdat |=  CONFIG_SYS_MDIO_PIN; \
-                       else    iop->pdat &= ~CONFIG_SYS_MDIO_PIN
-
-#define MDC(bit)       if(bit) iop->pdat |=  CONFIG_SYS_MDC_PIN; \
-                       else    iop->pdat &= ~CONFIG_SYS_MDC_PIN
-
-#define MIIDELAY       udelay(1)
-
-#endif /* CONFIG_ETHER_ON_FCC */
-
-#if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS
-#undef CONFIG_SPD_EEPROM       /* On new boards, SDRAM is soldered */
-#else
-#define CONFIG_HARD_I2C                1       /* To enable I2C support        */
-#define CONFIG_SYS_I2C_SPEED           100000  /* I2C speed and slave address  */
-#define CONFIG_SYS_I2C_SLAVE           0x7F
-
-#if defined(CONFIG_SPD_EEPROM) && !defined(CONFIG_SPD_ADDR)
-#define CONFIG_SPD_ADDR                0x50
-#endif
-#endif /* CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS */
-
-/*PCI*/
-#if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS
-#define CONFIG_PCI
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#define CONFIG_PCI_PNP
-#define CONFIG_PCI_BOOTDELAY 0
-#define CONFIG_PCI_SCAN_SHOW
-#endif
-
-#ifndef CONFIG_SDRAM_PBI
-#define CONFIG_SDRAM_PBI       0 /* By default, use bank-based interleaving */
-#endif
-
-#ifndef CONFIG_8260_CLKIN
-#if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS
-#define CONFIG_8260_CLKIN      100000000       /* in Hz */
-#else
-#define CONFIG_8260_CLKIN      66000000        /* in Hz */
-#endif
-#endif
-
-#define CONFIG_BAUDRATE                115200
-
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-#if defined(CONFIG_OF_LIBFDT)
-#define OF_TBCLK               (bd->bi_busfreq / 4)
-#endif
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_CACHE
-#define CONFIG_CMD_CDP
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IMMAP
-#define CONFIG_CMD_IRQ
-#define CONFIG_CMD_JFFS2
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_PORTIO
-#define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_SAVES
-#define CONFIG_CMD_SDRAM
-
-#undef CONFIG_CMD_XIMG
-
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-    #undef CONFIG_CMD_SDRAM
-    #undef CONFIG_CMD_I2C
-
-#elif CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS
-    #undef CONFIG_CMD_SDRAM
-    #undef CONFIG_CMD_I2C
-
-#else
-    #undef CONFIG_CMD_PCI
-
-#endif /* CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS */
-
-
-#define CONFIG_BOOTDELAY       5               /* autoboot after 5 seconds */
-#define CONFIG_BOOTCOMMAND     "bootm fff80000"        /* autoboot command */
-#define CONFIG_BOOTARGS                "root=/dev/mtdblock2"
-
-#if defined(CONFIG_CMD_KGDB)
-#undef CONFIG_KGDB_ON_SMC              /* define if kgdb on SMC */
-#define CONFIG_KGDB_ON_SCC             /* define if kgdb on SCC */
-#undef CONFIG_KGDB_NONE                /* define if kgdb on something else */
-#define CONFIG_KGDB_INDEX      2       /* which serial channel for kgdb */
-#define CONFIG_KGDB_BAUDRATE   115200  /* speed to run kgdb serial port at */
-#endif
-
-#define CONFIG_BZIP2   /* include support for bzip2 compressed images */
-#undef CONFIG_WATCHDOG /* disable platform specific watchdog */
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_LONGHELP                    /* undef to save memory     */
-#if defined(CONFIG_CMD_KGDB)
-#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_MAXARGS     16                      /* max number of command args   */
-#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size    */
-
-#define CONFIG_SYS_MEMTEST_START       0x00100000      /* memtest works on */
-#define CONFIG_SYS_MEMTEST_END         0x00f00000      /* 1 ... 15 MB in DRAM  */
-
-#define CONFIG_SYS_LOAD_ADDR           0x400000        /* default load address */
-
-#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, 230400 }
-
-#define CONFIG_SYS_FLASH_BASE          0xff800000
-#define CONFIG_SYS_MAX_FLASH_BANKS     1       /* max num of memory banks      */
-#define CONFIG_SYS_MAX_FLASH_SECT      32      /* max num of sects on one chip */
-#define CONFIG_SYS_FLASH_SIZE          8
-#define CONFIG_SYS_FLASH_ERASE_TOUT    8000    /* Timeout for Flash Erase (in ms)    */
-#define CONFIG_SYS_FLASH_WRITE_TOUT    5       /* Timeout for Flash Write (in ms)    */
-#define CONFIG_SYS_FLASH_LOCK_TOUT     5       /* Timeout for Flash Set Lock Bit (in ms) */
-#define CONFIG_SYS_FLASH_UNLOCK_TOUT   10000   /* Timeout for Flash Clear Lock Bits (in ms) */
-#define CONFIG_SYS_FLASH_PROTECTION            /* "Real" (hardware) sectors protection */
-
-/*
- * JFFS2 partitions
- *
- * Note: fake mtd_id used, no linux mtd map file
- */
-#define MTDIDS_DEFAULT         "nor0=mpc8260ads-0"
-#define MTDPARTS_DEFAULT       "mtdparts=mpc8260ads-0:-@1m(jffs2)"
-#define CONFIG_SYS_JFFS2_SORT_FRAGMENTS
-
-/* this is stuff came out of the Motorola docs */
-#ifndef CONFIG_SYS_LOWBOOT
-#define CONFIG_SYS_DEFAULT_IMMR        0x0F010000
-#endif
-
-#define CONFIG_SYS_IMMR                0xF0000000
-#define CONFIG_SYS_BCSR                0xF4500000
-#if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS
-#define CONFIG_SYS_PCI_INT             0xF8200000
-#endif
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_LSDRAM_BASE         0xFD000000
-
-#define RS232EN_1              0x02000002
-#define RS232EN_2              0x01000001
-#define FETHIEN1               0x08000008
-#define FETH1_RST              0x04000004
-#define FETHIEN2               0x10000000
-#define FETH2_RST              0x08000000
-#define BCSR_PCI_MODE          0x01000000
-
-#define CONFIG_SYS_INIT_RAM_ADDR       CONFIG_SYS_IMMR
-#define CONFIG_SYS_INIT_RAM_SIZE       0x2000  /* Size of used area in DPRAM   */
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-
-#ifdef CONFIG_SYS_LOWBOOT
-/* PQ2FADS flash HRCW = 0x0EB4B645 */
-#define CONFIG_SYS_HRCW_MASTER (   ( HRCW_BPS11 | HRCW_CIP )                       |\
-                           ( HRCW_L2CPC10 | HRCW_DPPC11 | HRCW_ISB100 )    |\
-                           ( HRCW_BMS | HRCW_MMR11 | HRCW_LBPC01 | HRCW_APPC10 ) |\
-                           ( HRCW_CS10PC01 | HRCW_MODCK_H0101 )             \
-                       )
-#else
-/* PQ2FADS BCSR HRCW = 0x0CB23645 */
-#define CONFIG_SYS_HRCW_MASTER (   ( HRCW_BPS11 | HRCW_CIP )                       |\
-                           ( HRCW_L2CPC10 | HRCW_DPPC10 | HRCW_ISB010 )    |\
-                           ( HRCW_BMS | HRCW_APPC10 )                      |\
-                           ( HRCW_MODCK_H0101 )                             \
-                       )
-#endif
-/* no slaves */
-#define CONFIG_SYS_HRCW_SLAVE1 0
-#define CONFIG_SYS_HRCW_SLAVE2 0
-#define CONFIG_SYS_HRCW_SLAVE3 0
-#define CONFIG_SYS_HRCW_SLAVE4 0
-#define CONFIG_SYS_HRCW_SLAVE5 0
-#define CONFIG_SYS_HRCW_SLAVE6 0
-#define CONFIG_SYS_HRCW_SLAVE7 0
-
-#define CONFIG_SYS_MONITOR_BASE    CONFIG_SYS_TEXT_BASE
-
-#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE)
-#   define CONFIG_SYS_RAMBOOT
-#endif
-
-#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-
-#ifdef CONFIG_BZIP2
-#define CONFIG_SYS_MALLOC_LEN          (4096 << 10)    /* Reserve 4 MB for malloc()    */
-#else
-#define CONFIG_SYS_MALLOC_LEN          (128 << 10)     /* Reserve 128 KB for malloc()  */
-#endif /* CONFIG_BZIP2 */
-
-#ifndef CONFIG_SYS_RAMBOOT
-#  define CONFIG_ENV_IS_IN_FLASH       1
-#  define CONFIG_ENV_SECT_SIZE 0x40000
-#  define CONFIG_ENV_ADDR              (CONFIG_SYS_MONITOR_BASE + CONFIG_ENV_SECT_SIZE)
-#else
-#  define CONFIG_ENV_IS_IN_NVRAM       1
-#  define CONFIG_ENV_ADDR              (CONFIG_SYS_MONITOR_BASE - 0x1000)
-#  define CONFIG_ENV_SIZE              0x200
-#endif /* CONFIG_SYS_RAMBOOT */
-
-#define CONFIG_SYS_CACHELINE_SIZE      32      /* For MPC8260 CPU */
-#if defined(CONFIG_CMD_KGDB)
-#  define CONFIG_SYS_CACHELINE_SHIFT   5       /* log base 2 of the above value */
-#endif
-
-#define CONFIG_SYS_HID0_INIT           0
-#define CONFIG_SYS_HID0_FINAL          (HID0_ICE | HID0_IFEM | HID0_ABE )
-
-#define CONFIG_SYS_HID2                0
-
-#define CONFIG_SYS_SYPCR               0xFFFFFFC3
-#define CONFIG_SYS_BCR                 0x100C0000
-#define CONFIG_SYS_SIUMCR              0x0A200000
-#define CONFIG_SYS_SCCR                SCCR_DFBRG01
-#define CONFIG_SYS_BR0_PRELIM          (CONFIG_SYS_FLASH_BASE | 0x00001801)
-#define CONFIG_SYS_OR0_PRELIM          0xFF800876
-#define CONFIG_SYS_BR1_PRELIM          (CONFIG_SYS_BCSR | 0x00001801)
-#define CONFIG_SYS_OR1_PRELIM          0xFFFF8010
-
-/*We need to configure chip select to use CPLD PCI IC on MPC8272ADS*/
-
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-#define CONFIG_SYS_BR3_PRELIM  (CONFIG_SYS_PCI_INT | 0x1801)   /* PCI interrupt controller */
-#define CONFIG_SYS_OR3_PRELIM  0xFFFF8010
-#elif CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS
-#define CONFIG_SYS_BR8_PRELIM  (CONFIG_SYS_PCI_INT | 0x1801)   /* PCI interrupt controller */
-#define CONFIG_SYS_OR8_PRELIM  0xFFFF8010
-#endif
-
-#define CONFIG_SYS_RMR                 RMR_CSRE
-#define CONFIG_SYS_TMCNTSC             (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
-#define CONFIG_SYS_PISCR               (PISCR_PS|PISCR_PTF|PISCR_PTE)
-#define CONFIG_SYS_RCCR                0
-
-#if (CONFIG_ADSTYPE == CONFIG_SYS_8266ADS) || (CONFIG_ADSTYPE == CONFIG_SYS_8272ADS)
-#undef CONFIG_SYS_LSDRAM_BASE          /* No local bus SDRAM on these boards */
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_8266ADS */
-
-#if CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS
-#define CONFIG_SYS_OR2                 0xFE002EC0
-#define CONFIG_SYS_PSDMR               0x824B36A3
-#define CONFIG_SYS_PSRT                0x13
-#define CONFIG_SYS_LSDMR               0x828737A3
-#define CONFIG_SYS_LSRT                0x13
-#define CONFIG_SYS_MPTPR               0x2800
-#elif CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-#define CONFIG_SYS_OR2                 0xFC002CC0
-#define CONFIG_SYS_PSDMR               0x834E24A3
-#define CONFIG_SYS_PSRT                0x13
-#define CONFIG_SYS_MPTPR               0x2800
-#else
-#define CONFIG_SYS_OR2                 0xFF000CA0
-#define CONFIG_SYS_PSDMR               0x016EB452
-#define CONFIG_SYS_PSRT                0x21
-#define CONFIG_SYS_LSDMR               0x0086A522
-#define CONFIG_SYS_LSRT                0x21
-#define CONFIG_SYS_MPTPR               0x1900
-#endif /* CONFIG_ADSTYPE == CONFIG_SYS_PQ2FADS */
-
-#define CONFIG_SYS_RESET_ADDRESS       0x04400000
-
-#if CONFIG_ADSTYPE >= CONFIG_SYS_PQ2FADS
-
-/* PCI Memory map (if different from default map */
-#define CONFIG_SYS_PCI_SLV_MEM_LOCAL   CONFIG_SYS_SDRAM_BASE           /* Local base */
-#define CONFIG_SYS_PCI_SLV_MEM_BUS             0x00000000              /* PCI base */
-#define CONFIG_SYS_PICMR0_MASK_ATTRIB  (PICMR_MASK_512MB | PICMR_ENABLE | \
-                                PICMR_PREFETCH_EN)
-
-/*
- * These are the windows that allow the CPU to access PCI address space.
- * All three PCI master windows, which allow the CPU to access PCI
- * prefetch, non prefetch, and IO space (see below), must all fit within
- * these windows.
- */
-
-/*
- * Master window that allows the CPU to access PCI Memory (prefetch).
- * This window will be setup with the second set of Outbound ATU registers
- * in the bridge.
- */
-
-#define CONFIG_SYS_PCI_MSTR_MEM_LOCAL  0x80000000          /* Local base */
-#define CONFIG_SYS_PCI_MSTR_MEM_BUS    0x80000000          /* PCI base   */
-#define        CONFIG_SYS_CPU_PCI_MEM_START    PCI_MSTR_MEM_LOCAL
-#define CONFIG_SYS_PCI_MSTR_MEM_SIZE   0x20000000          /* 512MB */
-#define CONFIG_SYS_POCMR0_MASK_ATTRIB  (POCMR_MASK_512MB | POCMR_ENABLE | POCMR_PREFETCH_EN)
-
-/*
- * Master window that allows the CPU to access PCI Memory (non-prefetch).
- * This window will be setup with the second set of Outbound ATU registers
- * in the bridge.
- */
-
-#define CONFIG_SYS_PCI_MSTR_MEMIO_LOCAL    0xA0000000          /* Local base */
-#define CONFIG_SYS_PCI_MSTR_MEMIO_BUS      0xA0000000          /* PCI base   */
-#define CONFIG_SYS_CPU_PCI_MEMIO_START     PCI_MSTR_MEMIO_LOCAL
-#define CONFIG_SYS_PCI_MSTR_MEMIO_SIZE     0x20000000          /* 512MB */
-#define CONFIG_SYS_POCMR1_MASK_ATTRIB      (POCMR_MASK_512MB | POCMR_ENABLE)
-
-/*
- * Master window that allows the CPU to access PCI IO space.
- * This window will be setup with the first set of Outbound ATU registers
- * in the bridge.
- */
-
-#define CONFIG_SYS_PCI_MSTR_IO_LOCAL       0xF6000000          /* Local base */
-#define CONFIG_SYS_PCI_MSTR_IO_BUS         0x00000000          /* PCI base   */
-#define CONFIG_SYS_CPU_PCI_IO_START        PCI_MSTR_IO_LOCAL
-#define CONFIG_SYS_PCI_MSTR_IO_SIZE        0x02000000          /* 64MB */
-#define CONFIG_SYS_POCMR2_MASK_ATTRIB      (POCMR_MASK_32MB | POCMR_ENABLE | POCMR_PCI_IO)
-
-
-/* PCIBR0 - for PCI IO*/
-#define CONFIG_SYS_PCI_MSTR0_LOCAL             CONFIG_SYS_PCI_MSTR_IO_LOCAL            /* Local base */
-#define CONFIG_SYS_PCIMSK0_MASK                ~(CONFIG_SYS_PCI_MSTR_IO_SIZE - 1U)     /* Size of window */
-/* PCIBR1 - prefetch and non-prefetch regions joined together */
-#define CONFIG_SYS_PCI_MSTR1_LOCAL             CONFIG_SYS_PCI_MSTR_MEM_LOCAL
-#define CONFIG_SYS_PCIMSK1_MASK                ~(CONFIG_SYS_PCI_MSTR_MEM_SIZE + CONFIG_SYS_PCI_MSTR_MEMIO_SIZE - 1U)
-
-#endif /* CONFIG_ADSTYPE == CONFIG_8272ADS*/
-
-#define CONFIG_HAS_ETH0
-
-#if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
-#define CONFIG_HAS_ETH1
-#endif
-
-#define CONFIG_NETDEV eth0
-#define CONFIG_LOADADDR 500000 /* default location for tftp and bootm */
-
-#define CONFIG_EXTRA_ENV_SETTINGS \
-       "netdev=" __stringify(CONFIG_NETDEV) "\0"                       \
-       "tftpflash=tftpboot $loadaddr $uboot; "                         \
-               "protect off " __stringify(CONFIG_SYS_TEXT_BASE)        \
-                       " +$filesize; " \
-               "erase " __stringify(CONFIG_SYS_TEXT_BASE) " +$filesize; " \
-               "cp.b $loadaddr " __stringify(CONFIG_SYS_TEXT_BASE)     \
-                       " $filesize; "  \
-               "protect on " __stringify(CONFIG_SYS_TEXT_BASE)         \
-                       " +$filesize; " \
-               "cmp.b $loadaddr " __stringify(CONFIG_SYS_TEXT_BASE)    \
-                       " $filesize\0"  \
-       "fdtaddr=400000\0"                                              \
-       "console=ttyCPM0\0"                                             \
-       "setbootargs=setenv bootargs "                                  \
-               "root=$rootdev rw console=$console,$baudrate $othbootargs\0" \
-       "setipargs=setenv bootargs nfsroot=$serverip:$rootpath "         \
-               "ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \
-               "root=$rootdev rw console=$console,$baudrate $othbootargs\0"
-
-#define CONFIG_NFSBOOTCOMMAND                                          \
-       "setenv rootdev /dev/nfs;"                                      \
-       "run setipargs;"                                                \
-       "tftp $loadaddr $bootfile;"                                     \
-       "tftp $fdtaddr $fdtfile;"                                       \
-       "bootm $loadaddr - $fdtaddr"
-
-#define CONFIG_RAMBOOTCOMMAND                                          \
-       "setenv rootdev /dev/ram;"                                      \
-       "run setbootargs;"                                              \
-       "tftp $ramdiskaddr $ramdiskfile;"                               \
-       "tftp $loadaddr $bootfile;"                                     \
-       "tftp $fdtaddr $fdtfile;"                                       \
-       "bootm $loadaddr $ramdiskaddr $fdtaddr"
-
-#endif /* __CONFIG_H */
diff --git a/include/configs/Rattler.h b/include/configs/Rattler.h
deleted file mode 100644 (file)
index a1e2ae9..0000000
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * U-Boot configuration for Analogue&Micro Rattler boards.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#ifdef CONFIG_MPC8248
-#define CPU_ID_STR             "MPC8248"
-#else
-#define CPU_ID_STR             "MPC8250"
-#endif /* CONFIG_MPC8248 */
-
-#define        CONFIG_SYS_TEXT_BASE    0xFE000000
-
-#define CONFIG_CPM2            1       /* Has a CPM2 */
-
-#define CONFIG_RATTLER                 /* Analogue&Micro Rattler board */
-
-/* Allow serial number (serial#) and MAC address (ethaddr) to be overwritten */
-#define CONFIG_ENV_OVERWRITE
-
-/*
- * Select serial console configuration
- *
- * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
- * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
- * for SCC).
- */
-#define        CONFIG_CONS_ON_SMC              /* Console is on SMC         */
-#undef  CONFIG_CONS_ON_SCC             /* It's not on SCC           */
-#undef CONFIG_CONS_NONE                /* It's not on external UART */
-#define CONFIG_CONS_INDEX      1       /* SMC1 is used for console  */
-
-/*
- * Select ethernet configuration
- *
- * If either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected,
- * then CONFIG_ETHER_INDEX must be set to the channel number (1-4 for
- * SCC, 1-3 for FCC)
- *
- * If CONFIG_ETHER_NONE is defined, then either the ethernet routines
- * must be defined elsewhere (as for the console), or CONFIG_CMD_NET
- * must be unset.
- */
-#undef CONFIG_ETHER_ON_SCC             /* Ethernet is not on SCC */
-#define CONFIG_ETHER_ON_FCC            /* Ethernet is on FCC     */
-#undef CONFIG_ETHER_NONE               /* No external Ethernet   */
-
-#ifdef CONFIG_ETHER_ON_FCC
-
-#define CONFIG_ETHER_INDEX     1       /* FCC1 is used for Ethernet */
-
-#if   (CONFIG_ETHER_INDEX == 1)
-
-/* - Rx clock is CLK11
- * - Tx clock is CLK10
- * - BDs/buffers on 60x bus
- * - Full duplex
- */
-#define CONFIG_SYS_CMXFCR_MASK1                (CMXFCR_FC1 | CMXFCR_RF1CS_MSK | CMXFCR_TF1CS_MSK)
-#define CONFIG_SYS_CMXFCR_VALUE1       (CMXFCR_RF1CS_CLK11 | CMXFCR_TF1CS_CLK10)
-#define CONFIG_SYS_CPMFCR_RAMTYPE      0
-#define CONFIG_SYS_FCC_PSMR            (FCC_PSMR_FDE | FCC_PSMR_LPB)
-
-#elif (CONFIG_ETHER_INDEX == 2)
-
-/* - Rx clock is CLK15
- * - Tx clock is CLK14
- * - BDs/buffers on 60x bus
- * - Full duplex
- */
-#define CONFIG_SYS_CMXFCR_MASK2                (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
-#define CONFIG_SYS_CMXFCR_VALUE2       (CMXFCR_RF2CS_CLK15 | CMXFCR_TF2CS_CLK14)
-#define CONFIG_SYS_CPMFCR_RAMTYPE      0
-#define CONFIG_SYS_FCC_PSMR            (FCC_PSMR_FDE | FCC_PSMR_LPB)
-
-#endif /* CONFIG_ETHER_INDEX */
-
-#define CONFIG_MII                     /* MII PHY management        */
-#define CONFIG_BITBANGMII              /* Bit-banged MDIO interface */
-/*
- * GPIO pins used for bit-banged MII communications
- */
-#define MDIO_PORT              2       /* Port C */
-#define MDIO_DECLARE           volatile ioport_t *iop = ioport_addr ( \
-                                       (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
-#define MDC_DECLARE            MDIO_DECLARE
-
-#define MDIO_ACTIVE            (iop->pdir |=  0x00400000)
-#define MDIO_TRISTATE          (iop->pdir &= ~0x00400000)
-#define MDIO_READ              ((iop->pdat &  0x00400000) != 0)
-
-#define MDIO(bit)              if(bit) iop->pdat |=  0x00400000; \
-                               else    iop->pdat &= ~0x00400000
-
-#define MDC(bit)               if(bit) iop->pdat |=  0x00800000; \
-                               else    iop->pdat &= ~0x00800000
-
-#define MIIDELAY               udelay(1)
-
-#endif /* CONFIG_ETHER_ON_FCC */
-
-#ifndef CONFIG_8260_CLKIN
-#define CONFIG_8260_CLKIN      100000000       /* in Hz */
-#endif
-
-#define CONFIG_BAUDRATE                38400
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_IMMAP
-#define CONFIG_CMD_JFFS2
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_PING
-
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds */
-#define CONFIG_BOOTCOMMAND     "bootm FE040000"        /* autoboot command */
-#define CONFIG_BOOTARGS                "root=/dev/mtdblock2 rw mtdparts=phys:1M(ROM)ro,-(root)"
-
-#if defined(CONFIG_CMD_KGDB)
-#undef CONFIG_KGDB_ON_SMC              /* define if kgdb on SMC */
-#define CONFIG_KGDB_ON_SCC             /* define if kgdb on SCC */
-#undef CONFIG_KGDB_NONE                /* define if kgdb on something else */
-#define CONFIG_KGDB_INDEX      2       /* which serial channel for kgdb */
-#define CONFIG_KGDB_BAUDRATE   115200  /* speed to run kgdb serial port at */
-#endif
-
-#define CONFIG_BZIP2   /* include support for bzip2 compressed images */
-#undef CONFIG_WATCHDOG                 /* disable platform specific watchdog */
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_LONGHELP                    /* undef to save memory     */
-#if defined(CONFIG_CMD_KGDB)
-#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_MAXARGS             16              /* max number of command args */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size  */
-
-#define CONFIG_SYS_MEMTEST_START       0x00100000      /* memtest works on */
-#define CONFIG_SYS_MEMTEST_END         0x00f00000      /* 1 ... 15 MB in DRAM  */
-
-#define CONFIG_SYS_LOAD_ADDR           0x100000        /* default load address */
-
-#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, 230400 }
-
-#define CONFIG_SYS_FLASH_BASE          0xFE000000
-#define CONFIG_SYS_FLASH_CFI
-#define CONFIG_FLASH_CFI_DRIVER
-#define CONFIG_SYS_MAX_FLASH_BANKS     1       /* max num of flash banks       */
-#define CONFIG_SYS_MAX_FLASH_SECT      256     /* max num of sects on one chip */
-
-#define        CONFIG_SYS_DIRECT_FLASH_TFTP
-
-#if defined(CONFIG_CMD_JFFS2)
-#define CONFIG_SYS_JFFS2_NUM_BANKS     CONFIG_SYS_MAX_FLASH_BANKS
-#define CONFIG_SYS_JFFS2_SORT_FRAGMENTS
-
-/*
- * JFFS2 partitions
- *
- */
-/* No command line, one static partition */
-#undef CONFIG_CMD_MTDPARTS
-#define CONFIG_JFFS2_DEV               "nor0"
-#define CONFIG_JFFS2_PART_SIZE         0xFFFFFFFF
-#define CONFIG_JFFS2_PART_OFFSET       0x00100000
-
-/* mtdparts command line support */
-/* Note: fake mtd_id used, no linux mtd map file */
-/*
-#define CONFIG_CMD_MTDPARTS
-#define MTDIDS_DEFAULT         "nor0=rattler-0"
-#define MTDPARTS_DEFAULT       "mtdparts=rattler-0:-@1m(jffs2)"
-*/
-#endif /* CONFIG_CMD_JFFS2 */
-
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE)
-#define CONFIG_SYS_RAMBOOT
-#endif
-
-#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
-
-#define CONFIG_ENV_IS_IN_FLASH
-
-#ifdef CONFIG_ENV_IS_IN_FLASH
-#define CONFIG_ENV_SECT_SIZE   0x10000
-#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#endif /* CONFIG_ENV_IS_IN_FLASH */
-
-#define CONFIG_SYS_DEFAULT_IMMR        0xFF010000
-
-#define CONFIG_SYS_IMMR                0xF0000000
-
-#define CONFIG_SYS_INIT_RAM_ADDR       CONFIG_SYS_IMMR
-#define CONFIG_SYS_INIT_RAM_SIZE       0x2000  /* Size of used area in DPRAM   */
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_SDRAM_SIZE          32
-#define CONFIG_SYS_SDRAM_BR            (CONFIG_SYS_SDRAM_BASE | 0x00000041)
-#define CONFIG_SYS_SDRAM_OR            0xFE002EC0
-
-#define CONFIG_SYS_BCSR                0xFC000000
-
-/* Hard reset configuration word */
-#define CONFIG_SYS_HRCW_MASTER         0x0A06875A /* Not used - provided by FPGA */
-/* No slaves */
-#define CONFIG_SYS_HRCW_SLAVE1         0
-#define CONFIG_SYS_HRCW_SLAVE2         0
-#define CONFIG_SYS_HRCW_SLAVE3         0
-#define CONFIG_SYS_HRCW_SLAVE4         0
-#define CONFIG_SYS_HRCW_SLAVE5         0
-#define CONFIG_SYS_HRCW_SLAVE6         0
-#define CONFIG_SYS_HRCW_SLAVE7         0
-
-#define CONFIG_SYS_MALLOC_LEN          (4096 << 10)    /* Reserve 4 MB for malloc()    */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-
-#define CONFIG_SYS_CACHELINE_SIZE      32      /* For MPC8260 CPUs */
-#if defined(CONFIG_CMD_KGDB)
-#  define CONFIG_SYS_CACHELINE_SHIFT   5       /* log base 2 of the above value */
-#endif
-
-#define CONFIG_SYS_HID0_INIT           0
-#define CONFIG_SYS_HID0_FINAL          (HID0_ICE | HID0_IFEM | HID0_ABE)
-
-#define CONFIG_SYS_HID2                0
-
-#define CONFIG_SYS_SIUMCR              0x0E04C000
-#define CONFIG_SYS_SYPCR               0xFFFFFFC3
-#define CONFIG_SYS_BCR                 0x00000000
-#define CONFIG_SYS_SCCR                SCCR_DFBRG01
-
-#define CONFIG_SYS_RMR                 RMR_CSRE
-#define CONFIG_SYS_TMCNTSC             (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
-#define CONFIG_SYS_PISCR               (PISCR_PS|PISCR_PTF|PISCR_PTE)
-#define CONFIG_SYS_RCCR                0
-
-#define CONFIG_SYS_PSDMR               0x8249A452
-#define CONFIG_SYS_PSRT                0x1F
-#define CONFIG_SYS_MPTPR               0x2000
-
-#define CONFIG_SYS_BR0_PRELIM          (CONFIG_SYS_FLASH_BASE | 0x00001001)
-#define CONFIG_SYS_OR0_PRELIM          0xFF001ED6
-#define CONFIG_SYS_BR7_PRELIM          (CONFIG_SYS_BCSR | 0x00000801)
-#define CONFIG_SYS_OR7_PRELIM          0xFFFF87F6
-
-#define CONFIG_SYS_RESET_ADDRESS       0xC0000000
-
-#endif /* __CONFIG_H */
diff --git a/include/configs/ZPC1900.h b/include/configs/ZPC1900.h
deleted file mode 100644 (file)
index d76a140..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2003-2005 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * U-Boot configuration for Zephyr Engineering ZPC.1900 board.
- * This port was developed and tested on Revision C board.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define CONFIG_ZPC1900         1       /* ...on Zephyr ZPC.1900 board */
-
-#define        CONFIG_SYS_TEXT_BASE    0xFE000000
-
-#define CPU_ID_STR             "MPC8265"
-#define CONFIG_CPM2            1       /* Has a CPM2 */
-
-/* Allow serial number (serial#) and MAC address (ethaddr) to be overwritten */
-#define CONFIG_ENV_OVERWRITE
-
-/*
- * Select serial console configuration
- *
- * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
- * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
- * for SCC).
- */
-#define        CONFIG_CONS_ON_SMC              /* Console is on SMC         */
-#undef  CONFIG_CONS_ON_SCC             /* It's not on SCC           */
-#undef CONFIG_CONS_NONE                /* It's not on external UART */
-#define CONFIG_CONS_INDEX      1       /* SMC1 is used for console  */
-
-/*
- * Select ethernet configuration
- *
- * If either CONFIG_ETHER_ON_SCC or CONFIG_ETHER_ON_FCC is selected,
- * then CONFIG_ETHER_INDEX must be set to the channel number (1-4 for
- * SCC, 1-3 for FCC)
- *
- * If CONFIG_ETHER_NONE is defined, then either the ethernet routines
- * must be defined elsewhere (as for the console), or CONFIG_CMD_NET
- * must be unset.
- */
-#undef CONFIG_ETHER_ON_SCC             /* Ethernet is not on SCC */
-#define CONFIG_ETHER_ON_FCC            /* Ethernet is on FCC     */
-#undef CONFIG_ETHER_NONE               /* No external Ethernet   */
-
-#ifdef CONFIG_ETHER_ON_FCC
-
-#define CONFIG_ETHER_INDEX     2       /* FCC2 is used for Ethernet */
-
-#if (CONFIG_ETHER_INDEX == 2)
-/*
- * - Rx clock is CLK13
- * - Tx clock is CLK14
- * - Select bus for bd/buffers (see 28-13)
- * - Full duplex
- */
-# define CONFIG_SYS_CMXFCR_MASK2       (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
-# define CONFIG_SYS_CMXFCR_VALUE2      (CMXFCR_RF2CS_CLK13 | CMXFCR_TF2CS_CLK14)
-# define CONFIG_SYS_CPMFCR_RAMTYPE     0
-# define CONFIG_SYS_FCC_PSMR           (FCC_PSMR_FDE | FCC_PSMR_LPB)
-
-#endif /* CONFIG_ETHER_INDEX */
-
-#define CONFIG_MII                     /* MII PHY management        */
-#define CONFIG_BITBANGMII              /* Bit-banged MDIO interface */
-/*
- * GPIO pins used for bit-banged MII communications
- */
-#define MDIO_PORT              2       /* Port C */
-#define MDIO_DECLARE           volatile ioport_t *iop = ioport_addr ( \
-                                       (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
-#define MDC_DECLARE            MDIO_DECLARE
-
-#define MDIO_ACTIVE            (iop->pdir |=  0x00400000)
-#define MDIO_TRISTATE          (iop->pdir &= ~0x00400000)
-#define MDIO_READ              ((iop->pdat &  0x00400000) != 0)
-
-#define MDIO(bit)              if(bit) iop->pdat |=  0x00400000; \
-                               else    iop->pdat &= ~0x00400000
-
-#define MDC(bit)               if(bit) iop->pdat |=  0x00200000; \
-                               else    iop->pdat &= ~0x00200000
-
-#define MIIDELAY               udelay(1)
-
-#endif /* CONFIG_ETHER_ON_FCC */
-
-#ifndef CONFIG_8260_CLKIN
-#define CONFIG_8260_CLKIN      66666666        /* in Hz */
-#endif
-
-#define CONFIG_BAUDRATE                38400
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_IMMAP
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_PING
-
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds */
-#define CONFIG_BOOTCOMMAND     "dhcp;bootm"    /* autoboot command */
-#define CONFIG_BOOTARGS                "root=/dev/nfs rw ip=:::::eth0:dhcp"
-
-#if defined(CONFIG_CMD_KGDB)
-#undef CONFIG_KGDB_ON_SMC              /* define if kgdb on SMC */
-#define CONFIG_KGDB_ON_SCC             /* define if kgdb on SCC */
-#undef CONFIG_KGDB_NONE                /* define if kgdb on something else */
-#define CONFIG_KGDB_INDEX      2       /* which serial channel for kgdb */
-#define CONFIG_KGDB_BAUDRATE   115200  /* speed to run kgdb serial port at */
-#endif
-
-#define CONFIG_BZIP2   /* include support for bzip2 compressed images */
-#undef CONFIG_WATCHDOG                 /* disable platform specific watchdog */
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_LONGHELP                    /* undef to save memory     */
-#if defined(CONFIG_CMD_KGDB)
-#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_MAXARGS             16              /* max number of command args */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size  */
-
-#define CONFIG_SYS_MEMTEST_START       0x00100000      /* memtest works on */
-#define CONFIG_SYS_MEMTEST_END         0x03800000      /* 1 ... 56 MB in DRAM  */
-
-#define CONFIG_SYS_LOAD_ADDR           0x400000        /* default load address */
-
-#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, 230400 }
-
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_SDRAM_SIZE          64
-
-#define CONFIG_SYS_IMMR                0xF0000000
-#define CONFIG_SYS_LSDRAM_BASE         0xFC000000
-#define CONFIG_SYS_FLASH_BASE          0xFE000000
-#define CONFIG_SYS_BCSR                0xFEA00000
-#define CONFIG_SYS_EEPROM              0xFEB00000
-#define CONFIG_SYS_FLSIMM_BASE         0xFF000000
-
-#define CONFIG_SYS_FLASH_CFI
-#define CONFIG_FLASH_CFI_DRIVER
-#define CONFIG_SYS_MAX_FLASH_BANKS     2       /* max num of flash banks       */
-#define CONFIG_SYS_MAX_FLASH_SECT      32      /* max num of sects on one chip */
-
-#define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLSIMM_BASE }
-
-#define BCSR_PCI_MODE          0x01
-
-#define CONFIG_SYS_INIT_RAM_ADDR       CONFIG_SYS_IMMR
-#define CONFIG_SYS_INIT_RAM_SIZE       0x4000  /* Size of used area in DPRAM   */
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-
-/* Hard reset configuration word */
-#define CONFIG_SYS_HRCW_MASTER         (HRCW_EBM | HRCW_BPS01| HRCW_CIP          |\
-                                HRCW_L2CPC10 | HRCW_DPPC00 | HRCW_ISB100 |\
-                                HRCW_BMS | HRCW_LBPC00 | HRCW_APPC10     |\
-                                HRCW_MODCK_H0111                          \
-                               ) /* 0x16848207 */
-/* No slaves */
-#define CONFIG_SYS_HRCW_SLAVE1         0
-#define CONFIG_SYS_HRCW_SLAVE2         0
-#define CONFIG_SYS_HRCW_SLAVE3         0
-#define CONFIG_SYS_HRCW_SLAVE4         0
-#define CONFIG_SYS_HRCW_SLAVE5         0
-#define CONFIG_SYS_HRCW_SLAVE6         0
-#define CONFIG_SYS_HRCW_SLAVE7         0
-
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-
-#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE)
-#define CONFIG_SYS_RAMBOOT
-#endif
-
-#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 256 kB for Monitor   */
-#define CONFIG_SYS_MALLOC_LEN          (4096 << 10)    /* Reserve 4 MB for malloc()    */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-
-#if !defined(CONFIG_ENV_IS_IN_FLASH) && !defined(CONFIG_ENV_IS_IN_NVRAM)
-#define CONFIG_ENV_IS_IN_NVRAM 1
-#endif
-
-#ifdef CONFIG_ENV_IS_IN_FLASH
-#  define CONFIG_ENV_SECT_SIZE 0x10000
-#  define CONFIG_ENV_ADDR              (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#else
-#  define CONFIG_ENV_ADDR              (CONFIG_SYS_EEPROM + 0x400)
-#  define CONFIG_ENV_SIZE              0x1000
-#  define CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-#endif
-
-#define CONFIG_SYS_CACHELINE_SIZE      32      /* For MPC8260 CPU */
-#if defined(CONFIG_CMD_KGDB)
-#  define CONFIG_SYS_CACHELINE_SHIFT   5       /* log base 2 of the above value */
-#endif
-
-#define CONFIG_SYS_HID0_INIT           (HID0_ICFI)
-#define CONFIG_SYS_HID0_FINAL          (HID0_ICE | HID0_IFEM | HID0_ABE)
-
-#define CONFIG_SYS_HID2                0
-
-#define CONFIG_SYS_SIUMCR              0x42200000
-#define CONFIG_SYS_SYPCR               0xFFFFFFC3
-#define CONFIG_SYS_BCR                 0x90000000
-#define CONFIG_SYS_SCCR                SCCR_DFBRG01
-
-#define CONFIG_SYS_RMR                 RMR_CSRE
-#define CONFIG_SYS_TMCNTSC             (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
-#define CONFIG_SYS_PISCR               (PISCR_PS|PISCR_PTF|PISCR_PTE)
-#define CONFIG_SYS_RCCR                0
-
-#define CONFIG_SYS_PSDMR               /* 0x834DA43B */0x014DA43A
-#define CONFIG_SYS_PSRT                0x0F/* 0x0C */
-#define CONFIG_SYS_LSDMR               0x0085A562
-#define CONFIG_SYS_LSRT                0x0F
-#define CONFIG_SYS_MPTPR               0x4000
-
-#define CONFIG_SYS_PSDRAM_BR           (CONFIG_SYS_SDRAM_BASE | 0x00000041)
-#define CONFIG_SYS_PSDRAM_OR           0xFC0028C0
-#define CONFIG_SYS_LSDRAM_BR           (CONFIG_SYS_LSDRAM_BASE | 0x00001861)
-#define CONFIG_SYS_LSDRAM_OR           0xFF803480
-
-#define CONFIG_SYS_BR0_PRELIM          (CONFIG_SYS_FLASH_BASE | 0x00000801)
-#define CONFIG_SYS_OR0_PRELIM          0xFFE00856
-#define CONFIG_SYS_BR5_PRELIM          (CONFIG_SYS_EEPROM | 0x00000801)
-#define CONFIG_SYS_OR5_PRELIM          0xFFFF03F6
-#define CONFIG_SYS_BR6_PRELIM          (CONFIG_SYS_FLSIMM_BASE | 0x00001801)
-#define CONFIG_SYS_OR6_PRELIM          0xFF000856
-#define CONFIG_SYS_BR7_PRELIM          (CONFIG_SYS_BCSR | 0x00000801)
-#define CONFIG_SYS_OR7_PRELIM          0xFFFF83F6
-
-#define CONFIG_SYS_RESET_ADDRESS       0xC0000000
-
-#endif /* __CONFIG_H */
index ccfda71c959d6e0ebc91b10b2ebc586e1290f550..341b21df270c305a767fb2a0aad78c6696b96d9f 100644 (file)
@@ -22,7 +22,6 @@
 #define CONFIG_SYS_AT91_MAIN_CLOCK      12000000 /* from 12 MHz crystal */
 
 #define CONFIG_AT91SAM9M10G45EK
-#define CONFIG_AT91FAMILY
 
 #define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs      */
 #define CONFIG_SETUP_MEMORY_TAGS
@@ -34,6 +33,8 @@
 #define CONFIG_CMD_BOOTZ
 #define CONFIG_OF_LIBFDT
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /* general purpose I/O */
 #define CONFIG_ATMEL_LEGACY            /* required until (g)pio is fixed */
 #define CONFIG_AT91_GPIO
 
 #endif
 
+/* MMC */
+#define CONFIG_CMD_MMC
+
+#ifdef CONFIG_CMD_MMC
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_GENERIC_ATMEL_MCI
+#endif
+
+#if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC)
+#define CONFIG_CMD_FAT
+#define CONFIG_DOS_PARTITION
+#endif
+
 /* Ethernet */
 #define CONFIG_MACB
 #define CONFIG_RMII
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_ATMEL
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS     2
-#define CONFIG_DOS_PARTITION
 #define CONFIG_USB_STORAGE
 
 #define CONFIG_SYS_LOAD_ADDR           0x22000000      /* load address */
 #define CONFIG_SYS_MEMTEST_START       CONFIG_SYS_SDRAM_BASE
 #define CONFIG_SYS_MEMTEST_END         0x23e00000
 
+#ifdef CONFIG_SYS_USE_NANDFLASH
 /* bootstrap + u-boot + env in nandflash */
 #define CONFIG_ENV_IS_IN_NAND
 #define CONFIG_ENV_OFFSET              0xc0000
        "256k(env),256k(env_redundant),256k(spare),"                    \
        "512k(dtb),6M(kernel)ro,-(rootfs) "                             \
        "root=/dev/mtdblock7 rw rootfstype=jffs2"
+#elif CONFIG_SYS_USE_MMC
+/* bootstrap + u-boot + env + linux in mmc */
+#define FAT_ENV_INTERFACE      "mmc"
+#define FAT_ENV_DEVICE         0
+#define FAT_ENV_PART           1
+#define FAT_ENV_FILE           "uboot.env"
+#define CONFIG_ENV_IS_IN_FAT
+#define CONFIG_FAT_WRITE
+#define CONFIG_ENV_SIZE                0x4000
+
+#define CONFIG_BOOTARGS                "console=ttyS0,115200 " \
+                               "mtdparts=atmel_nand:" \
+                               "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \
+                               "root=/dev/mmcblk0p2 rw rootwait"
+#define CONFIG_BOOTCOMMAND     "fatload mmc 0:1 0x71000000 dtb; " \
+                               "fatload mmc 0:1 0x72000000 zImage; " \
+                               "bootz 0x72000000 - 0x71000000"
+#endif
 
 #define CONFIG_BAUDRATE                        115200
 
index e23549d44431cf3793879aa70e37ff714046a7c5..9b0e588c6b825a51b3d0be91e0c20519358a6eda 100644 (file)
@@ -18,9 +18,6 @@
 
 #define CONFIG_SYS_TEXT_BASE           0x26f00000
 
-#define CONFIG_ARM926EJS
-#define CONFIG_AT91FAMILY
-
 /* ARM asynchronous clock */
 #define CONFIG_SYS_AT91_SLOW_CLOCK     32768           /* slow clock xtal */
 #define CONFIG_SYS_AT91_MAIN_CLOCK     16000000        /* main clock xtal */
index f0a6757ff66578044b84f1d628a3442bce502caf..b1d4baaff9501c3711ebddb3c7be1602c3f031a0 100644 (file)
@@ -18,7 +18,6 @@
 #define CONFIG_SYS_AT91_MAIN_CLOCK     12000000        /* 12 MHz crystal */
 
 #define CONFIG_AT91SAM9X5EK
-#define CONFIG_AT91FAMILY
 
 #define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs */
 #define CONFIG_SETUP_MEMORY_TAGS
@@ -30,6 +29,8 @@
 #define CONFIG_CMD_BOOTZ
 #define CONFIG_OF_LIBFDT
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /* general purpose I/O */
 #define CONFIG_ATMEL_LEGACY            /* required until (g)pio is fixed */
 #define CONFIG_AT91_GPIO
index 959e188d9ad162a51c39668183c317dc3348ffa2..6171060e9cd41ae9396a657e03508d1df166e0ed 100644 (file)
 
 #define CONFIG_SYS_TEXT_BASE  0x73f00000
 
-#define CONFIG_AT91_LEGACY
 #define CONFIG_ATMEL_LEGACY            /* required until (g)pio is fixed */
 
 /* ARM asynchronous clock */
 #define CONFIG_SYS_AT91_SLOW_CLOCK      32768
 #define CONFIG_SYS_AT91_MAIN_CLOCK      12000000 /* from 12 MHz crystal */
 
-#define CONFIG_AT91FAMILY
-
 #define CONFIG_CMDLINE_TAG             /* enable passing of ATAGs      */
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
index 39f7062388970a2bc6fdd62abfdc03020ed3430c..1feaefd14e6b7998903637ec2d8178f97e170f53 100644 (file)
@@ -32,7 +32,6 @@
 
 #include <asm/arch/hardware.h>
 
-#define CONFIG_AT91FAMILY
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_DISPLAY_CPUINFO
 #define CONFIG_BOARD_EARLY_INIT_F
diff --git a/include/configs/debris.h b/include/configs/debris.h
deleted file mode 100644 (file)
index 4631b86..0000000
+++ /dev/null
@@ -1,443 +0,0 @@
-/*
- * (C) Copyright 2001, 2002
- * Sangmoon Kim, Etin Systems, dogoil@etinsys.com.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/* ------------------------------------------------------------------------- */
-
-/*
- * board/config.h - configuration options, board specific
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define        CONFIG_SYS_TEXT_BASE    0xFFF00000
-
-/* Environments */
-
-/* bootargs */
-#define CONFIG_BOOTARGS \
-       "console=ttyS0,9600 init=/linuxrc " \
-       "root=/dev/nfs rw nfsroot=192.168.0.1:" \
-       "/tftpboot/target " \
-       "ip=192.168.0.2:192.168.0.1:192.168.0.1:" \
-       "255.255.255.0:debris:eth0:none " \
-       "mtdparts=phys:12m(root),-(kernel)"
-
-/* bootcmd */
-#define CONFIG_BOOTCOMMAND \
-       "tftp 800000 pImage; " \
-       "setenv bootargs console=ttyS0,9600 init=/linuxrc " \
-       "root=/dev/nfs rw nfsroot=${serverip}:${rootpath} " \
-       "ip=${ipaddr}:${serverip}:${gatewayip}:" \
-       "${netmask}:${hostname}:eth0:none " \
-       "mtdparts=phys:12m(root),-(kernel); " \
-       "bootm 800000"
-
-/* bootdelay */
-#define CONFIG_BOOTDELAY       5       /* autoboot 5s */
-
-/* baudrate */
-#define CONFIG_BAUDRATE                9600    /* console baudrate = 9600bps   */
-
-/* loads_echo */
-#define CONFIG_LOADS_ECHO      0       /* echo off for serial download */
-
-/* ethaddr */
-#undef CONFIG_ETHADDR
-
-/* eth2addr */
-#undef CONFIG_ETH2ADDR
-
-/* eth3addr */
-#undef CONFIG_ETH3ADDR
-
-/* ipaddr */
-#define CONFIG_IPADDR  192.168.0.2
-
-/* serverip */
-#define CONFIG_SERVERIP        192.168.0.1
-
-/* autoload */
-#undef CONFIG_SYS_AUTOLOAD
-
-/* rootpath */
-#define CONFIG_ROOTPATH "/tftpboot/target"
-
-/* gatewayip */
-#define CONFIG_GATEWAYIP 192.168.0.1
-
-/* netmask */
-#define CONFIG_NETMASK 255.255.255.0
-
-/* hostname */
-#define CONFIG_HOSTNAME debris
-
-/* bootfile */
-#define CONFIG_BOOTFILE "pImage"
-
-/* loadaddr */
-#define CONFIG_LOADADDR 800000
-
-/* preboot */
-#undef CONFIG_PREBOOT
-
-/* clocks_in_mhz */
-#undef CONFIG_CLOCKS_IN_MHZ
-
-
-/*
- * High Level Configuration Options
- * (easy to change)
- */
-
-#define CONFIG_MPC8245         1
-#define CONFIG_DEBRIS          1
-
-#if 0
-#define USE_DINK32             1
-#else
-#undef USE_DINK32
-#endif
-
-#define CONFIG_CONS_INDEX       1
-#define CONFIG_BAUDRATE                9600
-#define CONFIG_DRAM_SPEED      100             /* MHz */
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_CACHE
-#define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_JFFS2
-#define CONFIG_CMD_KGDB
-#define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_SAVES
-#define CONFIG_CMD_SDRAM
-
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_LONGHELP            1               /* undef to save memory         */
-#define CONFIG_SYS_CBSIZE              256             /* Console I/O Buffer Size      */
-#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)     /* Print Buffer Size    */
-#define CONFIG_SYS_MAXARGS             16              /* max number of command args   */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size    */
-#define CONFIG_SYS_LOAD_ADDR           0x00100000      /* default load address         */
-
-/*-----------------------------------------------------------------------
- * PCI stuff
- *-----------------------------------------------------------------------
- */
-#define CONFIG_PCI                             /* include pci support          */
-#define CONFIG_PCI_INDIRECT_BRIDGE     /* indirect PCI bridge support */
-#define CONFIG_PCI_PNP
-
-#define CONFIG_EEPRO100
-#define CONFIG_SYS_RX_ETH_BUFFER       8       /* use 8 rx buffer on eepro100  */
-#define CONFIG_EEPRO100_SROM_WRITE
-
-#define PCI_ENET0_IOADDR       0x80000000
-#define PCI_ENET0_MEMADDR      0x80000000
-#define        PCI_ENET1_IOADDR        0x81000000
-#define        PCI_ENET1_MEMADDR       0x81000000
-/*-----------------------------------------------------------------------
- * Start addresses for the final memory configuration
- * (Set up by the startup code)
- * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0
- */
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_MAX_RAM_SIZE        0x20000000
-#define CONFIG_VERY_BIG_RAM
-
-#define CONFIG_SYS_RESET_ADDRESS       0xFFF00100
-
-#if defined (USE_DINK32)
-#define CONFIG_SYS_MONITOR_LEN         0x00040000
-#define CONFIG_SYS_MONITOR_BASE        0x00090000
-#define CONFIG_SYS_RAMBOOT             1
-#define CONFIG_SYS_INIT_RAM_ADDR       (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#define CONFIG_SYS_INIT_RAM_SIZE       0x10000
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-#else
-#undef CONFIG_SYS_RAMBOOT
-#define CONFIG_SYS_MONITOR_LEN         0x00040000
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-
-
-#define CONFIG_SYS_INIT_RAM_ADDR     0x40000000
-#define CONFIG_SYS_INIT_RAM_SIZE      0x1000
-#define CONFIG_SYS_GBL_DATA_OFFSET  (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-
-#endif
-
-#define CONFIG_SYS_FLASH_BASE          0x7C000000
-#define CONFIG_SYS_FLASH_SIZE          (16*1024*1024)  /* debris has tiny eeprom       */
-
-#define CONFIG_SYS_MALLOC_LEN          (512 << 10)     /* Reserve 512 kB for malloc()  */
-
-#define CONFIG_SYS_MEMTEST_START       0x00000000      /* memtest works on             */
-#define CONFIG_SYS_MEMTEST_END         0x04000000      /* 0 ... 32 MB in DRAM          */
-
-#define CONFIG_SYS_EUMB_ADDR           0xFC000000
-
-#define CONFIG_SYS_FLASH_RANGE_BASE    0xFF000000      /* flash memory address range   */
-#define CONFIG_SYS_FLASH_RANGE_SIZE    0x01000000
-#define FLASH_BASE0_PRELIM     0x7C000000      /* debris flash         */
-
-/*
- * JFFS2 partitions
- *
- */
-/* No command line, one static partition, whole device */
-#undef CONFIG_CMD_MTDPARTS
-#define CONFIG_JFFS2_DEV               "nor0"
-#define CONFIG_JFFS2_PART_SIZE         0xFFFFFFFF
-#define CONFIG_JFFS2_PART_OFFSET       0x00000000
-
-/* mtdparts command line support */
-
-/* Use first bank for JFFS2, second bank contains U-Boot.
- *
- * Note: fake mtd_id's used, no linux mtd map file.
- */
-/*
-#define CONFIG_CMD_MTDPARTS
-#define MTDIDS_DEFAULT         "nor0=debris-0"
-#define MTDPARTS_DEFAULT       "mtdparts=debris-0:-(jffs2)"
-*/
-
-#define CONFIG_ENV_IS_IN_NVRAM      1
-#define CONFIG_ENV_OVERWRITE     1
-#define CONFIG_SYS_NVRAM_ACCESS_ROUTINE 1
-#define CONFIG_ENV_ADDR                0xFF000000 /* right at the start of NVRAM  */
-#define CONFIG_ENV_SIZE                0x400   /* Size of the Environment - 8K    */
-#define CONFIG_ENV_OFFSET              0       /* starting right at the beginning */
-
-#define CONFIG_SYS_NVRAM_BASE_ADDR     0xff000000
-
-/*
- * CONFIG_SYS_NVRAM_BASE_ADDR + CONFIG_SYS_NVRAM_VXWORKS_OFFS =
- * NV_RAM_ADDRS + NV_BOOT_OFFSET + NV_ENET_OFFSET
- */
-#define CONFIG_SYS_NVRAM_VXWORKS_OFFS  0x6900
-
-/*
- * select i2c support configuration
- *
- * Supported configurations are {none, software, hardware} drivers.
- * If the software driver is chosen, there are some additional
- * configuration items that the driver uses to drive the port pins.
- */
-#define CONFIG_HARD_I2C                1               /* To enable I2C support        */
-#undef  CONFIG_SYS_I2C_SOFT                    /* I2C bit-banged */
-#define CONFIG_SYS_I2C_SPEED           400000          /* I2C speed and slave address  */
-#define CONFIG_SYS_I2C_SLAVE           0x7F
-
-#ifdef CONFIG_SYS_I2C_SOFT
-#error "Soft I2C is not configured properly.  Please review!"
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_SOFT_SPEED      50000
-#define CONFIG_SYS_I2C_SOFT_SLAVE      0x7F
-#define I2C_PORT               3               /* Port A=0, B=1, C=2, D=3 */
-#define I2C_ACTIVE             (iop->pdir |=  0x00010000)
-#define I2C_TRISTATE           (iop->pdir &= ~0x00010000)
-#define I2C_READ               ((iop->pdat & 0x00010000) != 0)
-#define I2C_SDA(bit)           if(bit) iop->pdat |=  0x00010000; \
-                               else    iop->pdat &= ~0x00010000
-#define I2C_SCL(bit)           if(bit) iop->pdat |=  0x00020000; \
-                               else    iop->pdat &= ~0x00020000
-#define I2C_DELAY              udelay(5)       /* 1/4 I2C clock duration */
-#endif /* CONFIG_SYS_I2C_SOFT */
-
-#define CONFIG_SYS_I2C_EEPROM_ADDR     0x57            /* EEPROM IS24C02               */
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1               /* Bytes of address             */
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      3
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10      /* and takes up to 10 msec */
-
-#define CONFIG_SYS_FLASH_BANKS         { FLASH_BASE0_PRELIM }
-
-/*-----------------------------------------------------------------------
- * Definitions for initial stack pointer and data area (in DPRAM)
- */
-
-/*
- * NS16550 Configuration
- */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-
-#define CONFIG_SYS_NS16550_REG_SIZE    1
-
-#define CONFIG_SYS_NS16550_CLK         7372800
-
-#define CONFIG_SYS_NS16550_COM1        0xFF080000
-#define CONFIG_SYS_NS16550_COM2        (CONFIG_SYS_NS16550_COM1 + 8)
-#define CONFIG_SYS_NS16550_COM3        (CONFIG_SYS_NS16550_COM1 + 16)
-#define CONFIG_SYS_NS16550_COM4        (CONFIG_SYS_NS16550_COM1 + 24)
-
-/*
- * 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_CLK_FREQ  33333333  /* external frequency to pll */
-#define CONFIG_PLL_PCI_TO_MEM_MULTIPLIER 3
-
-#define CONFIG_SYS_DLL_EXTEND          0x00
-#define CONFIG_SYS_PCI_HOLD_DEL        0x20
-
-#define CONFIG_SYS_ROMNAL      15      /* rom/flash next access time */
-#define CONFIG_SYS_ROMFAL      31      /* rom/flash access time */
-
-#define CONFIG_SYS_REFINT      430     /* # of clocks between CBR refresh cycles */
-
-#define CONFIG_SYS_DBUS_SIZE2  1       /* set for 8-bit RCS1, clear for 32,64 */
-
-/* the following are for SDRAM only*/
-#define CONFIG_SYS_BSTOPRE     121     /* Burst To Precharge, sets open page interval */
-#define CONFIG_SYS_REFREC      8       /* Refresh to activate interval         */
-#define CONFIG_SYS_RDLAT       4       /* data latency from read command       */
-#define CONFIG_SYS_PRETOACT    3       /* Precharge to activate interval       */
-#define CONFIG_SYS_ACTTOPRE    5       /* Activate to Precharge interval       */
-#define CONFIG_SYS_ACTORW              3       /* Activate to R/W                      */
-#define CONFIG_SYS_SDMODE_CAS_LAT      3       /* SDMODE CAS latency                   */
-#define CONFIG_SYS_SDMODE_WRAP         0       /* SDMODE wrap type                     */
-#if 0
-#define CONFIG_SYS_SDMODE_BURSTLEN     2       /* OBSOLETE!  SDMODE Burst length 2=4, 3=8              */
-#endif
-
-#define CONFIG_SYS_REGISTERD_TYPE_BUFFER   1
-#define CONFIG_SYS_EXTROM 1
-#define CONFIG_SYS_REGDIMM 0
-
-
-/* memory bank settings*/
-/*
- * only bits 20-29 are actually used from these vales to set the
- * start/end address the upper two bits will be 0, and the lower 20
- * bits will be set to 0x00000 for a start address, or 0xfffff for an
- * end address
- */
-#define CONFIG_SYS_BANK0_START         0x00000000
-#define CONFIG_SYS_BANK0_END           (0x4000000 - 1)
-#define CONFIG_SYS_BANK0_ENABLE        1
-#define CONFIG_SYS_BANK1_START         0x04000000
-#define CONFIG_SYS_BANK1_END           (0x8000000 - 1)
-#define CONFIG_SYS_BANK1_ENABLE        1
-#define CONFIG_SYS_BANK2_START         0x3ff00000
-#define CONFIG_SYS_BANK2_END           0x3fffffff
-#define CONFIG_SYS_BANK2_ENABLE        0
-#define CONFIG_SYS_BANK3_START         0x3ff00000
-#define CONFIG_SYS_BANK3_END           0x3fffffff
-#define CONFIG_SYS_BANK3_ENABLE        0
-#define CONFIG_SYS_BANK4_START         0x00000000
-#define CONFIG_SYS_BANK4_END           0x00000000
-#define CONFIG_SYS_BANK4_ENABLE        0
-#define CONFIG_SYS_BANK5_START         0x00000000
-#define CONFIG_SYS_BANK5_END           0x00000000
-#define CONFIG_SYS_BANK5_ENABLE        0
-#define CONFIG_SYS_BANK6_START         0x00000000
-#define CONFIG_SYS_BANK6_END           0x00000000
-#define CONFIG_SYS_BANK6_ENABLE        0
-#define CONFIG_SYS_BANK7_START         0x00000000
-#define CONFIG_SYS_BANK7_END           0x00000000
-#define CONFIG_SYS_BANK7_ENABLE        0
-/*
- * Memory bank enable bitmask, specifying which of the banks defined above
- are actually present. MSB is for bank #7, LSB is for bank #0.
- */
-#define CONFIG_SYS_BANK_ENABLE         0x01
-
-#define CONFIG_SYS_ODCR                0x75    /* configures line driver impedances,   */
-                                       /* see 8240 book for bit definitions    */
-#define CONFIG_SYS_PGMAX               0x32    /* how long the 8240 retains the        */
-                                       /* currently accessed page in memory    */
-                                       /* see 8240 book for details            */
-
-/* SDRAM 0 - 256MB */
-#define CONFIG_SYS_IBAT0L      (CONFIG_SYS_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
-#define CONFIG_SYS_IBAT0U      (CONFIG_SYS_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
-
-/* stack in DCACHE @ 1GB (no backing mem) */
-#if defined(USE_DINK32)
-#define CONFIG_SYS_IBAT1L      (0x40000000 | BATL_PP_00 )
-#define CONFIG_SYS_IBAT1U      (0x40000000 | BATU_BL_128K )
-#else
-#define CONFIG_SYS_IBAT1L      (CONFIG_SYS_INIT_RAM_ADDR | BATL_PP_10 | BATL_MEMCOHERENCE)
-#define CONFIG_SYS_IBAT1U      (CONFIG_SYS_INIT_RAM_ADDR | BATU_BL_128K | BATU_VS | BATU_VP)
-#endif
-
-/* PCI memory */
-#define CONFIG_SYS_IBAT2L      (0x80000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
-#define CONFIG_SYS_IBAT2U      (0x80000000 | BATU_BL_256M | BATU_VS | BATU_VP)
-
-/* Flash, config addrs, etc */
-#define CONFIG_SYS_IBAT3L      (0xF0000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
-#define CONFIG_SYS_IBAT3U      (0xF0000000 | BATU_BL_256M | BATU_VS | BATU_VP)
-
-#define CONFIG_SYS_DBAT0L      CONFIG_SYS_IBAT0L
-#define CONFIG_SYS_DBAT0U      CONFIG_SYS_IBAT0U
-#define CONFIG_SYS_DBAT1L      CONFIG_SYS_IBAT1L
-#define CONFIG_SYS_DBAT1U      CONFIG_SYS_IBAT1U
-#define CONFIG_SYS_DBAT2L      CONFIG_SYS_IBAT2L
-#define CONFIG_SYS_DBAT2U      CONFIG_SYS_IBAT2U
-#define CONFIG_SYS_DBAT3L      CONFIG_SYS_IBAT3L
-#define CONFIG_SYS_DBAT3U      CONFIG_SYS_IBAT3U
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-/*-----------------------------------------------------------------------
- * FLASH organization
- */
-#define CONFIG_SYS_MAX_FLASH_BANKS     1       /* max number of memory banks           */
-#define CONFIG_SYS_MAX_FLASH_SECT      256     /* max number of sectors on one chip    */
-
-#define CONFIG_SYS_FLASH_ERASE_TOUT    120000  /* Timeout for Flash Erase (in ms)      */
-#define CONFIG_SYS_FLASH_WRITE_TOUT    500     /* Timeout for Flash Write (in ms)      */
-
-/*-----------------------------------------------------------------------
- * Cache Configuration
- */
-#define CONFIG_SYS_CACHELINE_SIZE      32      /* For MPC8240 CPU                      */
-#if defined(CONFIG_CMD_KGDB)
-#  define CONFIG_SYS_CACHELINE_SHIFT   5       /* log base 2 of the above value */
-#endif
-
-/* values according to the manual */
-
-#define CONFIG_DRAM_50MHZ      1
-#define CONFIG_SDRAM_50MHZ
-
-#define CONFIG_DISK_SPINUP_TIME 1000000
-
-#endif /* __CONFIG_H */
diff --git a/include/configs/ep8248.h b/include/configs/ep8248.h
deleted file mode 100644 (file)
index f1af96d..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2004 Arabella Software Ltd.
- * Yuli Barcohen <yuli@arabellasw.com>
- *
- * U-Boot configuration for Embedded Planet EP8248 boards.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define CONFIG_MPC8248
-#define CPU_ID_STR             "MPC8248"
-
-#define CONFIG_EP8248                  /* Embedded Planet EP8248 board */
-
-#define        CONFIG_SYS_TEXT_BASE    0xFFF00000
-
-#define CONFIG_BOARD_EARLY_INIT_F 1    /* Call board_early_init_f      */
-
-/* Allow serial number (serial#) and MAC address (ethaddr) to be overwritten */
-#define CONFIG_ENV_OVERWRITE
-
-/*
- * Select serial console configuration
- *
- * If either CONFIG_CONS_ON_SMC or CONFIG_CONS_ON_SCC is selected, then
- * CONFIG_CONS_INDEX must be set to the channel number (1-2 for SMC, 1-4
- * for SCC).
- */
-#define        CONFIG_CONS_ON_SMC              /* Console is on SMC         */
-#undef  CONFIG_CONS_ON_SCC             /* It's not on SCC           */
-#undef CONFIG_CONS_NONE                /* It's not on external UART */
-#define CONFIG_CONS_INDEX      1       /* SMC1 is used for console  */
-
-#define CONFIG_SYS_BCSR                0xFA000000
-
-/* Pass open firmware flat device tree */
-#define CONFIG_OF_LIBFDT       1
-#define CONFIG_OF_BOARD_SETUP  1
-
-#define OF_TBCLK        (bd->bi_busfreq / 4)
-#define OF_STDOUT_PATH  "/soc/cpm/serial <at> 11a80"
-
-/* Select ethernet configuration */
-#undef CONFIG_ETHER_ON_SCC             /* Ethernet is not on SCC */
-#define CONFIG_ETHER_ON_FCC            /* Ethernet is on FCC     */
-#undef CONFIG_ETHER_NONE               /* No external Ethernet   */
-
-#define CONFIG_SYS_CPMFCR_RAMTYPE      0
-#define CONFIG_SYS_FCC_PSMR            (FCC_PSMR_FDE | FCC_PSMR_LPB)
-
-#define CONFIG_HAS_ETH0
-#define CONFIG_ETHER_ON_FCC1           1
-/* - Rx clock is CLK10
- * - Tx clock is CLK11
- * - BDs/buffers on 60x bus
- * - Full duplex
- */
-#define CONFIG_SYS_CMXFCR_MASK1        (CMXFCR_FC1 | CMXFCR_RF1CS_MSK | CMXFCR_TF1CS_MSK)
-#define CONFIG_SYS_CMXFCR_VALUE1       (CMXFCR_RF1CS_CLK10 | CMXFCR_TF1CS_CLK11)
-
-#define CONFIG_HAS_ETH1
-#define CONFIG_ETHER_ON_FCC2           1
-/* - Rx clock is CLK13
- * - Tx clock is CLK14
- * - BDs/buffers on 60x bus
- * - Full duplex
- */
-#define CONFIG_SYS_CMXFCR_MASK2        (CMXFCR_FC2 | CMXFCR_RF2CS_MSK | CMXFCR_TF2CS_MSK)
-#define CONFIG_SYS_CMXFCR_VALUE2       (CMXFCR_RF2CS_CLK13 | CMXFCR_TF2CS_CLK14)
-
-#define CONFIG_MII                     /* MII PHY management        */
-#define CONFIG_BITBANGMII              /* Bit-banged MDIO interface */
-/*
- * GPIO pins used for bit-banged MII communications
- */
-#define MDIO_PORT              0       /* Not used - implemented in BCSR */
-
-#define MDIO_ACTIVE            (*(vu_char *)(CONFIG_SYS_BCSR + 8) &= 0xFB)
-#define MDIO_TRISTATE          (*(vu_char *)(CONFIG_SYS_BCSR + 8) |= 0x04)
-#define MDIO_READ              (*(vu_char *)(CONFIG_SYS_BCSR + 8) & 1)
-
-#define MDIO(bit)              if(bit) *(vu_char *)(CONFIG_SYS_BCSR + 8) |= 0x01; \
-                               else    *(vu_char *)(CONFIG_SYS_BCSR + 8) &= 0xFE
-
-#define MDC(bit)               if(bit) *(vu_char *)(CONFIG_SYS_BCSR + 8) |= 0x02; \
-                               else    *(vu_char *)(CONFIG_SYS_BCSR + 8) &= 0xFD
-
-#define MIIDELAY               udelay(1)
-
-#ifndef CONFIG_8260_CLKIN
-#define CONFIG_8260_CLKIN      66000000        /* in Hz */
-#endif
-
-#define CONFIG_BAUDRATE                38400
-
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_ECHO
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_IMMAP
-#define CONFIG_CMD_MII
-#define CONFIG_CMD_PING
-
-
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds */
-#define CONFIG_BOOTCOMMAND     "bootm FF860000"        /* autoboot command */
-#define CONFIG_BOOTARGS                "root=/dev/mtdblock1 rw mtdparts=phys:7M(root),-(root)ro"
-
-#if defined(CONFIG_CMD_KGDB)
-#undef CONFIG_KGDB_ON_SMC              /* define if kgdb on SMC */
-#define CONFIG_KGDB_ON_SCC             /* define if kgdb on SCC */
-#undef CONFIG_KGDB_NONE                /* define if kgdb on something else */
-#define CONFIG_KGDB_INDEX      1       /* which serial channel for kgdb */
-#define CONFIG_KGDB_BAUDRATE   115200  /* speed to run kgdb serial port at */
-#endif
-
-#define CONFIG_BZIP2   /* include support for bzip2 compressed images */
-#undef CONFIG_WATCHDOG                 /* disable platform specific watchdog */
-
-/*
- * Miscellaneous configurable options
- */
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_LONGHELP                    /* undef to save memory     */
-#if defined(CONFIG_CMD_KGDB)
-#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_MAXARGS             16              /* max number of command args */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE       /* Boot Argument Buffer Size  */
-
-#define CONFIG_SYS_MEMTEST_START       0x00100000      /* memtest works on */
-#define CONFIG_SYS_MEMTEST_END         0x00f00000      /* 1 ... 15 MB in DRAM  */
-
-#define CONFIG_SYS_LOAD_ADDR           0x100000        /* default load address */
-
-#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200, 230400 }
-
-#define CONFIG_SYS_FLASH_BASE          0xFF800000
-#define CONFIG_SYS_FLASH_CFI
-#define CONFIG_FLASH_CFI_DRIVER
-#define CONFIG_SYS_MAX_FLASH_BANKS     1       /* max num of flash banks       */
-#define CONFIG_SYS_MAX_FLASH_SECT      256     /* max num of sects on one chip */
-
-#define        CONFIG_SYS_DIRECT_FLASH_TFTP
-
-#if defined(CONFIG_CMD_JFFS2)
-#define CONFIG_SYS_JFFS2_FIRST_BANK    0
-#define CONFIG_SYS_JFFS2_NUM_BANKS     CONFIG_SYS_MAX_FLASH_BANKS
-#define CONFIG_SYS_JFFS2_FIRST_SECTOR  0
-#define CONFIG_SYS_JFFS2_LAST_SECTOR   62
-#define CONFIG_SYS_JFFS2_SORT_FRAGMENTS
-#define CONFIG_SYS_JFFS_CUSTOM_PART
-#endif
-
-#if defined(CONFIG_CMD_I2C)
-#define CONFIG_HARD_I2C                1       /* To enable I2C support        */
-#define CONFIG_SYS_I2C_SPEED           100000  /* I2C speed                    */
-#define CONFIG_SYS_I2C_SLAVE           0x7F    /* I2C slave address            */
-#endif
-
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-#if (CONFIG_SYS_MONITOR_BASE < CONFIG_SYS_FLASH_BASE)
-#define CONFIG_SYS_RAMBOOT
-#endif
-
-#define CONFIG_SYS_MONITOR_LEN         (256 << 10)     /* Reserve 256KB for Monitor */
-
-#define CONFIG_ENV_IS_IN_FLASH
-
-#ifdef CONFIG_ENV_IS_IN_FLASH
-#define CONFIG_ENV_SECT_SIZE   0x20000
-#define CONFIG_ENV_ADDR                (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#endif /* CONFIG_ENV_IS_IN_FLASH */
-
-#define CONFIG_SYS_DEFAULT_IMMR        0x00010000
-
-#define CONFIG_SYS_IMMR                0xF0000000
-
-#define CONFIG_SYS_INIT_RAM_ADDR       CONFIG_SYS_IMMR
-#define CONFIG_SYS_INIT_RAM_SIZE       0x2000  /* Size of used area in DPRAM   */
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-
-/* Hard reset configuration word */
-#define CONFIG_SYS_HRCW_MASTER         0x0C40025A /* Not used - provided by FPGA */
-/* No slaves */
-#define CONFIG_SYS_HRCW_SLAVE1         0
-#define CONFIG_SYS_HRCW_SLAVE2         0
-#define CONFIG_SYS_HRCW_SLAVE3         0
-#define CONFIG_SYS_HRCW_SLAVE4         0
-#define CONFIG_SYS_HRCW_SLAVE5         0
-#define CONFIG_SYS_HRCW_SLAVE6         0
-#define CONFIG_SYS_HRCW_SLAVE7         0
-
-#define CONFIG_SYS_MALLOC_LEN          (4096 << 10)    /* Reserve 4 MB for malloc()    */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-
-#define CONFIG_SYS_CACHELINE_SIZE      32      /* For MPC8260 CPUs */
-#if defined(CONFIG_CMD_KGDB)
-#  define CONFIG_SYS_CACHELINE_SHIFT   5       /* log base 2 of the above value */
-#endif
-
-#define CONFIG_SYS_HID0_INIT           0
-#define CONFIG_SYS_HID0_FINAL          (HID0_ICE | HID0_IFEM | HID0_ABE)
-
-#define CONFIG_SYS_HID2                0
-
-#define CONFIG_SYS_SIUMCR              0x01240200
-#define CONFIG_SYS_SYPCR               0xFFFF0683
-#define CONFIG_SYS_BCR                 0x00000000
-#define CONFIG_SYS_SCCR                SCCR_DFBRG01
-
-#define CONFIG_SYS_RMR                 RMR_CSRE
-#define CONFIG_SYS_TMCNTSC             (TMCNTSC_SEC|TMCNTSC_ALR|TMCNTSC_TCF|TMCNTSC_TCE)
-#define CONFIG_SYS_PISCR               (PISCR_PS|PISCR_PTF|PISCR_PTE)
-#define CONFIG_SYS_RCCR                0
-
-#define CONFIG_SYS_MPTPR               0x1300
-#define CONFIG_SYS_PSDMR               0x82672522
-#define CONFIG_SYS_PSRT                0x4B
-
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_SDRAM_BR            (CONFIG_SYS_SDRAM_BASE | 0x00001841)
-#define CONFIG_SYS_SDRAM_OR            0xFF0030C0
-
-#define CONFIG_SYS_BR0_PRELIM          (CONFIG_SYS_FLASH_BASE | 0x00001801)
-#define CONFIG_SYS_OR0_PRELIM          0xFF8008C2
-#define CONFIG_SYS_BR2_PRELIM          (CONFIG_SYS_BCSR | 0x00000801)
-#define CONFIG_SYS_OR2_PRELIM          0xFFF00864
-
-#define CONFIG_SYS_RESET_ADDRESS       0xC0000000
-
-#endif /* __CONFIG_H */
index 480d8678c6f8f2756313ed86ff2271ff30441125..c81fc44b121c5e28db83dea0642b5892a7799b18 100644 (file)
@@ -23,8 +23,6 @@
 #define CONFIG_MACH_TYPE MACH_TYPE_ETHERNUT5
 
 /* CPU information */
-#define CONFIG_ARM926EJS
-#define CONFIG_AT91FAMILY
 #define CONFIG_DISPLAY_CPUINFO         /* Display at console. */
 #define CONFIG_ARCH_CPU_INIT
 
index a6202cfab446ca30b806f153860fe0f7b92728cb..da1c837cc7a6efdd28b1f75355b2c6697ac95de9 100644 (file)
@@ -13,6 +13,7 @@
 #define CONFIG_SYS_THUMB_BUILD
 
 #define CONFIG_SYS_NO_FLASH
+#define CONFIG_SYS_GENERIC_BOARD
 
 #define CONFIG_OF_BOARD_SETUP
 #define CONFIG_FIT
diff --git a/include/configs/kvme080.h b/include/configs/kvme080.h
deleted file mode 100644 (file)
index c352a1c..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * (C) Copyright 2005
- * Sangmoon Kim, dogoil@etinsys.com.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define CONFIG_MPC8245         1
-#define CONFIG_KVME080         1
-
-#define        CONFIG_SYS_TEXT_BASE    0xFFF00000
-
-#define CONFIG_CONS_INDEX      1
-
-#define CONFIG_BAUDRATE                115200
-
-#define CONFIG_BOOTDELAY       5
-
-#define CONFIG_IPADDR          192.168.0.2
-#define CONFIG_NETMASK         255.255.255.0
-#define CONFIG_SERVERIP                192.168.0.1
-
-#define CONFIG_BOOTARGS \
-       "console=ttyS0,115200 " \
-       "root=/dev/nfs rw nfsroot=192.168.0.1:/opt/eldk/ppc_82xx " \
-       "ip=192.168.0.2:192.168.0.1:192.168.0.1:255.255.255.0:" \
-       "kvme080:eth0:none " \
-       "mtdparts=phys_mapped_flash:12m(root),-(kernel)"
-
-#define CONFIG_BOOTCOMMAND \
-       "tftp 800000 kvme080/uImage; " \
-       "bootm 800000"
-
-#define CONFIG_LOADADDR                800000
-
-#define CONFIG_BOARD_EARLY_INIT_F
-#define CONFIG_BOARD_EARLY_INIT_R
-#define CONFIG_MISC_INIT_R
-
-#define CONFIG_LOADS_ECHO      1
-#undef CONFIG_SYS_LOADS_BAUD_CHANGE
-
-#undef CONFIG_WATCHDOG
-
-/*
- * BOOTP options
- */
-#define CONFIG_BOOTP_SUBNETMASK
-#define CONFIG_BOOTP_GATEWAY
-#define CONFIG_BOOTP_HOSTNAME
-#define CONFIG_BOOTP_BOOTPATH
-#define CONFIG_BOOTP_BOOTFILESIZE
-
-
-#define CONFIG_MAC_PARTITION
-#define CONFIG_DOS_PARTITION
-
-#define CONFIG_RTC_DS164x
-
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_CACHE
-#define CONFIG_CMD_DATE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_DIAG
-#define CONFIG_CMD_EEPROM
-#define CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_JFFS2
-#define CONFIG_CMD_NFS
-#define CONFIG_CMD_PCI
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_SDRAM
-#define CONFIG_CMD_SNTP
-
-
-#define CONFIG_NETCONSOLE
-
-#define CONFIG_SYS_LONGHELP
-#define CONFIG_SYS_CBSIZE              256
-#define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
-#define CONFIG_SYS_MAXARGS             16
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
-
-#define CONFIG_SYS_MEMTEST_START       0x00400000
-#define CONFIG_SYS_MEMTEST_END         0x07C00000
-
-#define CONFIG_SYS_LOAD_ADDR           0x00100000
-
-#define CONFIG_SYS_INIT_RAM_ADDR       0x40000000
-#define CONFIG_SYS_INIT_RAM_SIZE       0x1000
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_FLASH_BASE          0x7C000000
-#define CONFIG_SYS_EUMB_ADDR           0xFC000000
-#define CONFIG_SYS_NVRAM_BASE_ADDR     0xFF000000
-#define CONFIG_SYS_NS16550_COM1        0xFF080000
-#define CONFIG_SYS_NS16550_COM2        0xFF080010
-#define CONFIG_SYS_NS16550_COM3        0xFF080020
-#define CONFIG_SYS_NS16550_COM4        0xFF080030
-#define CONFIG_SYS_RESET_ADDRESS       0xFFF00100
-
-#define CONFIG_SYS_MAX_RAM_SIZE        0x20000000
-#define CONFIG_SYS_FLASH_SIZE          (16 * 1024 * 1024)
-#define CONFIG_SYS_NVRAM_SIZE          0x7FFF8
-
-#define CONFIG_VERY_BIG_RAM
-
-#define CONFIG_SYS_MONITOR_LEN         0x00040000
-#define CONFIG_SYS_MONITOR_BASE        CONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_MALLOC_LEN          (512 << 10)
-
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)
-
-#define CONFIG_SYS_FLASH_CFI
-#define CONFIG_FLASH_CFI_DRIVER
-#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
-#define CONFIG_SYS_FLASH_PROTECTION
-#define CONFIG_SYS_FLASH_EMPTY_INFO
-#define CONFIG_SYS_FLASH_PROTECT_CLEAR
-
-#define CONFIG_SYS_MAX_FLASH_BANKS     1
-#define CONFIG_SYS_MAX_FLASH_SECT      256
-
-#define CONFIG_SYS_FLASH_ERASE_TOUT    120000
-#define CONFIG_SYS_FLASH_WRITE_TOUT    500
-
-#define CONFIG_SYS_JFFS2_FIRST_BANK    0
-#define CONFIG_SYS_JFFS2_NUM_BANKS     1
-
-#define CONFIG_ENV_IS_IN_NVRAM 1
-#define CONFIG_ENV_OVERWRITE   1
-#define CONFIG_SYS_NVRAM_ACCESS_ROUTINE
-#define CONFIG_ENV_ADDR                CONFIG_SYS_NVRAM_BASE_ADDR
-#define CONFIG_ENV_SIZE                0x400
-#define CONFIG_ENV_OFFSET              0
-
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE    1
-#define CONFIG_SYS_NS16550_CLK         14745600
-
-#define CONFIG_PCI
-#define CONFIG_PCI_INDIRECT_BRIDGE
-#define CONFIG_PCI_PNP
-
-#define CONFIG_EEPRO100
-#define CONFIG_EEPRO100_SROM_WRITE
-
-#define CONFIG_SYS_RX_ETH_BUFFER       8
-
-#define CONFIG_HARD_I2C                1
-#define CONFIG_SYS_I2C_SPEED           400000
-#define CONFIG_SYS_I2C_SLAVE           0x7F
-
-#define CONFIG_SYS_I2C_EEPROM_ADDR             0x57
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         1
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      3
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10
-
-#define CONFIG_SYS_CLK_FREQ    33333333
-
-#define CONFIG_SYS_CACHELINE_SIZE      32
-#if defined(CONFIG_CMD_KGDB)
-#  define CONFIG_SYS_CACHELINE_SHIFT   5
-#endif
-
-#define CONFIG_SYS_DLL_EXTEND          0x00
-#define CONFIG_SYS_PCI_HOLD_DEL        0x20
-
-#define CONFIG_SYS_ROMNAL              15
-#define CONFIG_SYS_ROMFAL              31
-
-#define CONFIG_SYS_REFINT              430
-
-#define CONFIG_SYS_DBUS_SIZE2          1
-
-#define CONFIG_SYS_BSTOPRE             121
-#define CONFIG_SYS_REFREC              8
-#define CONFIG_SYS_RDLAT               4
-#define CONFIG_SYS_PRETOACT            3
-#define CONFIG_SYS_ACTTOPRE            5
-#define CONFIG_SYS_ACTORW              3
-#define CONFIG_SYS_SDMODE_CAS_LAT      3
-#define CONFIG_SYS_SDMODE_WRAP         0
-
-#define CONFIG_SYS_REGISTERD_TYPE_BUFFER       1
-#define CONFIG_SYS_EXTROM                      1
-#define CONFIG_SYS_REGDIMM                     0
-
-#define CONFIG_SYS_BANK0_START         0x00000000
-#define CONFIG_SYS_BANK0_END           (0x4000000 - 1)
-#define CONFIG_SYS_BANK0_ENABLE        1
-#define CONFIG_SYS_BANK1_START         0x04000000
-#define CONFIG_SYS_BANK1_END           (0x8000000 - 1)
-#define CONFIG_SYS_BANK1_ENABLE        1
-#define CONFIG_SYS_BANK2_START         0x3ff00000
-#define CONFIG_SYS_BANK2_END           0x3fffffff
-#define CONFIG_SYS_BANK2_ENABLE        0
-#define CONFIG_SYS_BANK3_START         0x3ff00000
-#define CONFIG_SYS_BANK3_END           0x3fffffff
-#define CONFIG_SYS_BANK3_ENABLE        0
-#define CONFIG_SYS_BANK4_START         0x00000000
-#define CONFIG_SYS_BANK4_END           0x00000000
-#define CONFIG_SYS_BANK4_ENABLE        0
-#define CONFIG_SYS_BANK5_START         0x00000000
-#define CONFIG_SYS_BANK5_END           0x00000000
-#define CONFIG_SYS_BANK5_ENABLE        0
-#define CONFIG_SYS_BANK6_START         0x00000000
-#define CONFIG_SYS_BANK6_END           0x00000000
-#define CONFIG_SYS_BANK6_ENABLE        0
-#define CONFIG_SYS_BANK7_START         0x00000000
-#define CONFIG_SYS_BANK7_END           0x00000000
-#define CONFIG_SYS_BANK7_ENABLE        0
-
-#define CONFIG_SYS_BANK_ENABLE         0x03
-
-#define CONFIG_SYS_ODCR                0x75
-#define CONFIG_SYS_PGMAX               0x32
-
-#define CONFIG_SYS_IBAT0L      (CONFIG_SYS_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
-#define CONFIG_SYS_IBAT0U      (CONFIG_SYS_SDRAM_BASE | BATU_BL_256M | BATU_VS | BATU_VP)
-
-#define CONFIG_SYS_IBAT1L      (CONFIG_SYS_INIT_RAM_ADDR | BATL_PP_10 | BATL_MEMCOHERENCE)
-#define CONFIG_SYS_IBAT1U      (CONFIG_SYS_INIT_RAM_ADDR | BATU_BL_128K | BATU_VS | BATU_VP)
-
-#define CONFIG_SYS_IBAT2L      (0x80000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
-#define CONFIG_SYS_IBAT2U      (0x80000000 | BATU_BL_256M | BATU_VS | BATU_VP)
-
-#define CONFIG_SYS_IBAT3L      (0xF0000000 | BATL_PP_10 | BATL_CACHEINHIBIT)
-#define CONFIG_SYS_IBAT3U      (0xF0000000 | BATU_BL_256M | BATU_VS | BATU_VP)
-
-#define CONFIG_SYS_DBAT0L      CONFIG_SYS_IBAT0L
-#define CONFIG_SYS_DBAT0U      CONFIG_SYS_IBAT0U
-#define CONFIG_SYS_DBAT1L      CONFIG_SYS_IBAT1L
-#define CONFIG_SYS_DBAT1U      CONFIG_SYS_IBAT1U
-#define CONFIG_SYS_DBAT2L      CONFIG_SYS_IBAT2L
-#define CONFIG_SYS_DBAT2U      CONFIG_SYS_IBAT2U
-#define CONFIG_SYS_DBAT3L      CONFIG_SYS_IBAT3L
-#define CONFIG_SYS_DBAT3U      CONFIG_SYS_IBAT3U
-
-#endif /* __CONFIG_H */
index 96a889fe87e36bf74abd9aafe55cff7807471dd4..f5f49613c89365fc6c35a55db8fa3cb1d858099f 100644 (file)
@@ -66,6 +66,7 @@
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_SPI
 #define CONFIG_CMD_USB
+#define CONFIG_CMD_FS_GENERIC
 
 #define CONFIG_DOS_PARTITION
 #define CONFIG_EFI_PARTITION
 #define CONFIG_LOADADDR                0x00800000
 #define CONFIG_BOOTCOMMAND     "run bootcmd_${bootsource}"
 #define CONFIG_BOOTARGS                "console=ttyS0,115200 root=/dev/sda2"
+
+#if defined(CONFIG_LSXHL)
+#define CONFIG_FDTFILE "kirkwood-lsxhl.dtb"
+#elif defined(CONFIG_LSCHLV2)
+#define CONFIG_FDTFILE "kirkwood-lschlv2.dtb"
+#else
+#error "Unsupported board"
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS                                      \
-       "bootsource=hdd\0"                                              \
+       "bootsource=legacy\0"                                           \
        "hdpart=0:1\0"                                                  \
-       "bootcmd_net=bootp 0x00100000 uImage "                          \
-               "&& tftpboot 0x00800000 uInitrd "                       \
+       "kernel_addr=0x00800000\0"                                      \
+       "ramdisk_addr=0x01000000\0"                                     \
+       "fdt_addr=0x01ff0000\0"                                         \
+       "bootcmd_legacy=ide reset "                                     \
+               "&& load ide ${hdpart} 0x00100000 /uImage.buffalo "     \
+               "&& load ide ${hdpart} 0x00800000 /initrd.buffalo "     \
                "&& bootm 0x00100000 0x00800000\0"                      \
+       "bootcmd_net=bootp ${kernel_addr} uImage "                      \
+               "&& tftpboot ${ramdisk_addr} uInitrd "                  \
+               "&& tftpboot ${fdt_addr} " CONFIG_FDTFILE " "           \
+               "&& bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \
        "bootcmd_hdd=ide reset "                                        \
-               "&& ext2load ide ${hdpart} 0x00100000 /uImage "         \
-               "&& ext2load ide ${hdpart} 0x00800000 /uInitrd "        \
-               "&& bootm 0x00100000 0x00800000\0"                      \
+               "&& load ide ${hdpart} ${kernel_addr} /uImage "         \
+               "&& load ide ${hdpart} ${ramdisk_addr} /uInitrd "       \
+               "&& load ide ${hdpart} ${fdt_addr} "                    \
+                       "/" CONFIG_FDTFILE " "                          \
+               "&& bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \
        "bootcmd_usb=usb start "                                        \
-               "&& fatload usb 0:1 0x00100000 /uImage "                \
-               "&& fatload usb 0:1 0x00800000 /uInitrd "               \
-               "&& bootm 0x00100000 0x00800000\0"                      \
+               "&& load usb 0:1 ${kernel_addr} /uImage "               \
+               "&& load usb 0:1 ${ramdisk_addr} /uInitrd "             \
+               "&& load usb 0:1 ${fdt_addr} "                          \
+                       "/" CONFIG_FDTFILE " "                          \
+               "&& bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0" \
        "bootcmd_rescue=run config_nc_dhcp; run nc\0"                   \
        "eraseenv=sf probe 0 "                                          \
                "&& sf erase " __stringify(CONFIG_ENV_OFFSET)           \
 #undef CONFIG_SYS_IDE_MAXDEVICE
 #define CONFIG_SYS_IDE_MAXDEVICE       1
 #define CONFIG_SYS_ATA_IDE0_OFFSET     MV_SATA_PORT0_OFFSET
+#define CONFIG_SYS_64BIT_LBA
 #endif
 
 #endif /* _CONFIG_LSXL_H */
diff --git a/include/configs/quad100hd.h b/include/configs/quad100hd.h
deleted file mode 100644 (file)
index e91e805..0000000
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * (C) Copyright 2008
- * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de.
- *
- * SPDX-License-Identifier:    GPL-2.0+
- */
-
-/************************************************************************
- * quad100hd.h - configuration for Quad100hd board
- ***********************************************************************/
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-/*-----------------------------------------------------------------------
- * High Level Configuration Options
- *----------------------------------------------------------------------*/
-#define CONFIG_QUAD100HD       1               /* Board is Quad100hd   */
-#define CONFIG_405EP           1               /* Specifc 405EP support*/
-
-#define        CONFIG_SYS_TEXT_BASE    0xFFFC0000
-
-#define CONFIG_SYS_CLK_FREQ     33333333 /* external frequency to pll   */
-
-#define CONFIG_BOARD_EARLY_INIT_F 1            /* Call board_early_init_f */
-
-#define PLLMR0_DEFAULT         PLLMR0_266_133_66 /* no PCI */
-#define PLLMR1_DEFAULT         PLLMR1_266_133_66 /* no PCI */
-
-/* the environment is in the EEPROM by default */
-#define CONFIG_ENV_IS_IN_EEPROM
-#undef CONFIG_ENV_IS_IN_FLASH
-
-#define CONFIG_PPC4xx_EMAC
-#define CONFIG_HAS_ETH1                1
-#define CONFIG_MII             1       /* MII PHY management           */
-#define CONFIG_PHY_ADDR                0x01    /* PHY address                  */
-#define CONFIG_SYS_RX_ETH_BUFFER       16      /* Number of ethernet rx buffers & descriptors */
-#define CONFIG_PHY_RESET       1
-#define CONFIG_PHY_RESET_DELAY 300     /* PHY RESET recovery delay     */
-
-/*
- * Command line configuration.
- */
-#include <config_cmd_default.h>
-
-#undef CONFIG_CMD_ASKENV
-#undef CONFIG_CMD_CACHE
-#define CONFIG_CMD_DHCP
-#undef CONFIG_CMD_DIAG
-#define CONFIG_CMD_EEPROM
-#undef CONFIG_CMD_ELF
-#define CONFIG_CMD_I2C
-#undef CONFIG_CMD_IRQ
-#define CONFIG_CMD_JFFS2
-#undef CONFIG_CMD_MII
-#define CONFIG_CMD_NAND
-#undef CONFIG_CMD_PING
-#define CONFIG_CMD_REGINFO
-
-#undef CONFIG_WATCHDOG                 /* watchdog disabled            */
-
-/*-----------------------------------------------------------------------
- * SDRAM
- *----------------------------------------------------------------------*/
-/*
- * SDRAM configuration (please see cpu/ppc/sdram.[ch])
- */
-#define CONFIG_SDRAM_BANK0  1
-
-/* FIX! SDRAM timings used in datasheet */
-#define CONFIG_SYS_SDRAM_CL            3       /* CAS latency */
-#define CONFIG_SYS_SDRAM_tRP           20      /* PRECHARGE command period */
-#define CONFIG_SYS_SDRAM_tRC           66      /* ACTIVE-to-ACTIVE command period */
-#define CONFIG_SYS_SDRAM_tRCD          20      /* ACTIVE-to-READ delay */
-#define CONFIG_SYS_SDRAM_tRFC          66      /* Auto refresh period */
-
-/*
- * JFFS2
- */
-#define CONFIG_SYS_JFFS2_FIRST_BANK    0
-#ifdef  CONFIG_SYS_KERNEL_IN_JFFS2
-#define CONFIG_SYS_JFFS2_FIRST_SECTOR  0   /* JFFS starts at block 0 */
-#else /* kernel not in JFFS */
-#define CONFIG_SYS_JFFS2_FIRST_SECTOR  8   /* block 0-7 is kernel (1MB = 8 sectors) */
-#endif
-#define CONFIG_SYS_JFFS2_NUM_BANKS     1
-
-/*-----------------------------------------------------------------------
- * Serial Port
- *----------------------------------------------------------------------*/
-#define CONFIG_CONS_INDEX      1       /* Use UART0                    */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE    1
-#define CONFIG_SYS_NS16550_CLK         get_serial_clock()
-#undef CONFIG_SYS_EXT_SERIAL_CLOCK                     /* external serial clock */
-#define CONFIG_SYS_BASE_BAUD           691200
-#define CONFIG_BAUDRATE                115200
-
-/* The following table includes the supported baudrates */
-#define CONFIG_SYS_BAUDRATE_TABLE      \
-       {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-
-/*-----------------------------------------------------------------------
- * Miscellaneous configurable options
- *----------------------------------------------------------------------*/
-#define CONFIG_SYS_LONGHELP                    /* undef to save memory         */
-#if defined(CONFIG_CMD_KGDB)
-#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_MAXARGS             16      /* max number of command args   */
-#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size  */
-
-#define CONFIG_SYS_MEMTEST_START       0x0400000 /* memtest works on           */
-#define CONFIG_SYS_MEMTEST_END         0x0C00000 /* 4 ... 12 MB in DRAM        */
-
-#define CONFIG_SYS_LOAD_ADDR           0x100000  /* default load address       */
-#define CONFIG_SYS_EXTBDINFO           1       /* To use extended board_info (bd_t) */
-
-#define CONFIG_LOADS_ECHO      1       /* echo on for serial download  */
-#define CONFIG_SYS_LOADS_BAUD_CHANGE   1       /* allow baudrate change        */
-
-#define CONFIG_CMDLINE_EDITING 1       /* add command line history     */
-#define CONFIG_LOOPW            1       /* enable loopw command         */
-#define CONFIG_MX_CYCLIC        1       /* enable mdc/mwc commands      */
-#define CONFIG_ZERO_BOOTDELAY_CHECK    /* check for keypress on bootdelay==0 */
-#define CONFIG_VERSION_VARIABLE 1      /* include version env variable */
-
-/*-----------------------------------------------------------------------
- * I2C
- *----------------------------------------------------------------------*/
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_PPC4XX
-#define CONFIG_SYS_I2C_PPC4XX_CH0
-#define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
-#define CONFIG_SYS_I2C_PPC4XX_SLAVE_0          0x7F
-
-#define CONFIG_SYS_I2C_EEPROM_ADDR     0x50            /* base address */
-#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2               /* bytes of address */
-
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      5       /* 8 byte write page size */
-#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10      /* and takes up to 10 msec */
-#define CONFIG_SYS_EEPROM_SIZE                 0x2000
-
-/*-----------------------------------------------------------------------
- * Start addresses for the final memory configuration
- * (Set up by the startup code)
- * Please note that CONFIG_SYS_SDRAM_BASE _must_ start at 0
- */
-#define CONFIG_SYS_SDRAM_BASE          0x00000000
-#define CONFIG_SYS_FLASH_BASE          0xFFC00000
-#define CONFIG_SYS_MONITOR_LEN         (256 * 1024)    /* Reserve 256 kB for Monitor   */
-#define CONFIG_SYS_MALLOC_LEN          (128 * 1024)    /* Reserve 128 kB for malloc()  */
-#define CONFIG_SYS_MONITOR_BASE        (CONFIG_SYS_TEXT_BASE)
-
-/*
- * For booting Linux, the board info and command line data
- * have to be in the first 8 MB of memory, since this is
- * the maximum mapped by the Linux kernel during initialization.
- */
-#define CONFIG_SYS_BOOTMAPSZ           (8 << 20)       /* Initial Memory map for Linux */
-
-/*-----------------------------------------------------------------------
- * FLASH organization
- */
-#define CONFIG_SYS_FLASH_CFI                   /* The flash is CFI compatible  */
-#define        CONFIG_FLASH_CFI_DRIVER
-
-#define CONFIG_SYS_FLASH_BANKS_LIST    { CONFIG_SYS_FLASH_BASE }
-
-#define CONFIG_SYS_MAX_FLASH_BANKS     1       /* max number of memory banks   */
-#define CONFIG_SYS_MAX_FLASH_SECT      128     /* max number of sectors on one chip */
-
-#define CONFIG_SYS_FLASH_ERASE_TOUT    120000  /* Timeout for Flash Erase (in ms) */
-#define CONFIG_SYS_FLASH_WRITE_TOUT    500     /* Timeout for Flash Write (in ms) */
-
-#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1    /* use buffered writes (20x faster) */
-#define CONFIG_SYS_FLASH_INCREMENT      0       /* there is only one bank         */
-
-#define CONFIG_SYS_FLASH_EMPTY_INFO            /* print 'E' for empty sector on flinfo */
-#define CONFIG_SYS_FLASH_QUIET_TEST    1       /* don't warn upon unknown flash */
-
-#ifdef CONFIG_ENV_IS_IN_FLASH
-#define CONFIG_ENV_SECT_SIZE   0x10000 /* size of one complete sector  */
-/* the environment is located before u-boot */
-#define CONFIG_ENV_ADDR                (CONFIG_SYS_TEXT_BASE - CONFIG_ENV_SECT_SIZE)
-
-/* Address and size of Redundant Environment Sector    */
-#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR - CONFIG_ENV_SECT_SIZE)
-#define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SECT_SIZE)
-#endif
-
-#ifdef CONFIG_ENV_IS_IN_EEPROM
-#define CONFIG_ENV_SIZE                0x400           /* Size of Environment vars */
-#define CONFIG_ENV_OFFSET              0x00000000
-#define CONFIG_SYS_ENABLE_CRC_16       1       /* Intrinsyc formatting used crc16 */
-#endif
-
-/* partly from PPCBoot */
-/* NAND */
-#define CONFIG_NAND
-#ifdef CONFIG_NAND
-#define CONFIG_SYS_NAND_BASE   0x60000000
-#define CONFIG_SYS_NAND_CS     10   /* our CS is GPIO10 */
-#define CONFIG_SYS_NAND_RDY    23   /* our RDY is GPIO23 */
-#define CONFIG_SYS_NAND_CE     24   /* our CE is GPIO24  */
-#define CONFIG_SYS_NAND_CLE    31   /* our CLE is GPIO31 */
-#define CONFIG_SYS_NAND_ALE    30   /* our ALE is GPIO30 */
-#define CONFIG_SYS_MAX_NAND_DEVICE     1
-
-#endif
-
-/*-----------------------------------------------------------------------
- * Definitions for initial stack pointer and data area (in data cache)
- */
-/* use on chip memory (OCM) for temperary stack until sdram is tested */
-/* see ./arch/powerpc/cpu/ppc4xx/start.S */
-#define CONFIG_SYS_TEMP_STACK_OCM      1
-
-/* On Chip Memory location */
-#define CONFIG_SYS_OCM_DATA_ADDR       0xF8000000
-#define CONFIG_SYS_OCM_DATA_SIZE       0x1000
-#define CONFIG_SYS_INIT_RAM_ADDR       CONFIG_SYS_OCM_DATA_ADDR /* inside of OCM               */
-#define CONFIG_SYS_INIT_RAM_SIZE       CONFIG_SYS_OCM_DATA_SIZE /* Size of used area in RAM    */
-
-#define CONFIG_SYS_GBL_DATA_OFFSET     (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
-#define CONFIG_SYS_INIT_SP_OFFSET      CONFIG_SYS_GBL_DATA_OFFSET
-
-/*-----------------------------------------------------------------------
- * External Bus Controller (EBC) Setup
- * Taken from PPCBoot board/icecube/icecube.h
- */
-
-/* see ./arch/powerpc/cpu/ppc4xx/cpu_init.c ./cpu/ppc4xx/ndfc.c */
-#define CONFIG_SYS_EBC_PB0AP           0x04002480
-/* AMD NOR flash - this corresponds to FLASH_BASE so may be correct */
-#define CONFIG_SYS_EBC_PB0CR           0xFFC5A000
-#define CONFIG_SYS_EBC_PB1AP           0x04005480
-#define CONFIG_SYS_EBC_PB1CR           0x60018000
-#define CONFIG_SYS_EBC_PB2AP           0x00000000
-#define CONFIG_SYS_EBC_PB2CR           0x00000000
-#define CONFIG_SYS_EBC_PB3AP           0x00000000
-#define CONFIG_SYS_EBC_PB3CR           0x00000000
-#define CONFIG_SYS_EBC_PB4AP           0x00000000
-#define CONFIG_SYS_EBC_PB4CR           0x00000000
-
-/*-----------------------------------------------------------------------
- * Definitions for GPIO setup (PPC405EP specific)
- *
- * Taken in part from PPCBoot board/icecube/icecube.h
- */
-/* see ./arch/powerpc/cpu/ppc4xx/cpu_init.c ./cpu/ppc4xx/start.S */
-#define CONFIG_SYS_GPIO0_OSRL          0x55555550
-#define CONFIG_SYS_GPIO0_OSRH          0x00000110
-#define CONFIG_SYS_GPIO0_ISR1L         0x00000000
-#define CONFIG_SYS_GPIO0_ISR1H         0x15555445
-#define CONFIG_SYS_GPIO0_TSRL          0x00000000
-#define CONFIG_SYS_GPIO0_TSRH          0x00000000
-#define CONFIG_SYS_GPIO0_TCR           0xFFFF8097
-#define CONFIG_SYS_GPIO0_ODR           0x00000000
-
-#if defined(CONFIG_CMD_KGDB)
-#define CONFIG_KGDB_BAUDRATE   230400          /* speed to run kgdb serial port */
-#endif
-
-/* ENVIRONMENT VARS */
-
-#define CONFIG_IPADDR          192.168.1.67
-#define CONFIG_SERVERIP                192.168.1.50
-#define CONFIG_GATEWAYIP       192.168.1.1
-#define CONFIG_NETMASK         255.255.255.0
-#define CONFIG_LOADADDR                300000
-#define CONFIG_BOOTDELAY       5       /* autoboot after 5 seconds */
-
-/* pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT       1
-
-#endif /* __CONFIG_H */
index 41c946d1ec8aeaf2f9af41cacad0ac2ad447e5a5..f72ab0bad01c74da3b8d67a96b1b75f07d3aa7fe 100644 (file)
 #define CONFIG_SYS_AT91_SLOW_CLOCK      32768
 #define CONFIG_SYS_AT91_MAIN_CLOCK      12000000 /* from 12 MHz crystal */
 
-#define CONFIG_AT91FAMILY
 #define CONFIG_ARCH_CPU_INIT
+
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_SKIP_LOWLEVEL_INIT
+#endif
+
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_DISPLAY_CPUINFO
 
 #define CONFIG_CMD_BOOTZ
 #define CONFIG_OF_LIBFDT               /* Device Tree support */
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /* general purpose I/O */
 #define CONFIG_AT91_GPIO
 
 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS
 #define CONFIG_SYS_SDRAM_SIZE          0x10000000
 
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_INIT_SP_ADDR                0x310000
+#else
 #define CONFIG_SYS_INIT_SP_ADDR \
        (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
+#endif
 
 /* NAND flash */
 #define CONFIG_CMD_NAND
 /* Size of malloc() pool */
 #define CONFIG_SYS_MALLOC_LEN          (4 * 1024 * 1024)
 
+/* SPL */
+#define CONFIG_SPL
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_TEXT_BASE           0x300000
+#define CONFIG_SPL_MAX_SIZE            0x10000
+#define CONFIG_SPL_BSS_START_ADDR      0x20000000
+#define CONFIG_SPL_BSS_MAX_SIZE                0x80000
+#define CONFIG_SYS_SPL_MALLOC_START    0x20080000
+#define CONFIG_SYS_SPL_MALLOC_SIZE     0x80000
+
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_GPIO_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+
+#define CONFIG_SPL_BOARD_INIT
+#define CONFIG_SYS_MONITOR_LEN         (512 << 10)
+
+#ifdef CONFIG_SYS_USE_MMC
+#define CONFIG_SPL_LDSCRIPT            arch/arm/cpu/at91-common/u-boot-spl.lds
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS     0x400
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x200
+#define CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION   1
+#define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME       "u-boot.img"
+#define CONFIG_SPL_FAT_SUPPORT
+#define CONFIG_SPL_LIBDISK_SUPPORT
+
+#elif CONFIG_SYS_USE_NANDFLASH
+#define CONFIG_SPL_NAND_SUPPORT
+#define CONFIG_SPL_NAND_DRIVERS
+#define CONFIG_SPL_NAND_BASE
+#define CONFIG_SYS_NAND_U_BOOT_OFFS    0x40000
+#define CONFIG_SYS_NAND_5_ADDR_CYCLE
+#define CONFIG_SYS_NAND_PAGE_SIZE      0x800
+#define CONFIG_SYS_NAND_PAGE_COUNT     64
+#define CONFIG_SYS_NAND_OOBSIZE                64
+#define CONFIG_SYS_NAND_BLOCK_SIZE     0x20000
+#define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
+
+#endif
+
 #endif
index 516be85fe08d9a1af60624826465a237448c5d6b..da2718044cf18b9f11641f3a695203411c7205fc 100644 (file)
@@ -21,7 +21,6 @@
 #define CONFIG_SYS_AT91_SLOW_CLOCK      32768
 #define CONFIG_SYS_AT91_MAIN_CLOCK      12000000 /* from 12 MHz crystal */
 
-#define CONFIG_AT91FAMILY
 #define CONFIG_ARCH_CPU_INIT
 
 #ifndef CONFIG_SPL_BUILD
@@ -34,6 +33,8 @@
 #define CONFIG_CMD_BOOTZ
 #define CONFIG_OF_LIBFDT               /* Device Tree support */
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /* general purpose I/O */
 #define CONFIG_AT91_GPIO
 
 #define CONFIG_SYS_NAND_OOBSIZE                64
 #define CONFIG_SYS_NAND_BLOCK_SIZE     0x20000
 #define CONFIG_SYS_NAND_BAD_BLOCK_POS  0x0
+#define CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER
 
 #elif CONFIG_SYS_USE_SERIALFLASH
 #define CONFIG_SPL_SPI_SUPPORT
diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
new file mode 100644 (file)
index 0000000..9b693f7
--- /dev/null
@@ -0,0 +1,24 @@
+/*
+ * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net>
+ * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net>
+ *
+ * Configuration settings for the Allwinner A20 (sun7i) CPU
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * A20 specific configuration
+ */
+#define CONFIG_SUN7I           /* sun7i SoC generation */
+
+#define CONFIG_SYS_PROMPT              "sun7i# "
+
+/*
+ * Include common sunxi configuration where most the settings are
+ */
+#include <configs/sunxi-common.h>
+
+#endif /* __CONFIG_H */
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
new file mode 100644 (file)
index 0000000..5d72d62
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * (C) Copyright 2012-2012 Henrik Nordstrom <henrik@henriknordstrom.net>
+ *
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * Configuration settings for the Allwinner sunxi series of boards.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _SUNXI_COMMON_CONFIG_H
+#define _SUNXI_COMMON_CONFIG_H
+
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_SUNXI           /* sunxi family */
+#ifdef CONFIG_SPL_BUILD
+#ifndef CONFIG_SPL_FEL
+#define CONFIG_SYS_THUMB_BUILD /* Thumbs mode to save space in SPL */
+#endif
+#endif
+
+#include <asm/arch/cpu.h>      /* get chip and board defs */
+
+#define CONFIG_SYS_TEXT_BASE           0x4a000000
+
+/*
+ * Display CPU information
+ */
+#define CONFIG_DISPLAY_CPUINFO
+
+/* Serial & console */
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+/* ns16550 reg in the low bits of cpu reg */
+#define CONFIG_SYS_NS16550_REG_SIZE    -4
+#define CONFIG_SYS_NS16550_CLK         24000000
+#define CONFIG_SYS_NS16550_COM1                SUNXI_UART0_BASE
+#define CONFIG_SYS_NS16550_COM2                SUNXI_UART1_BASE
+#define CONFIG_SYS_NS16550_COM3                SUNXI_UART2_BASE
+#define CONFIG_SYS_NS16550_COM4                SUNXI_UART3_BASE
+
+/* DRAM Base */
+#define CONFIG_SYS_SDRAM_BASE          0x40000000
+#define CONFIG_SYS_INIT_RAM_ADDR       0x0
+#define CONFIG_SYS_INIT_RAM_SIZE       0x8000  /* 32 KiB */
+
+#define CONFIG_SYS_INIT_SP_OFFSET \
+       (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE)
+#define CONFIG_SYS_INIT_SP_ADDR \
+       (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET)
+
+#define CONFIG_NR_DRAM_BANKS           1
+#define PHYS_SDRAM_0                   CONFIG_SYS_SDRAM_BASE
+#define PHYS_SDRAM_0_SIZE              0x80000000 /* 2 GiB */
+
+#define CONFIG_CMD_MEMORY
+#define CONFIG_CMD_SETEXPR
+
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_INITRD_TAG
+
+/* mmc config */
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_MMC
+#define CONFIG_MMC_SUNXI
+#define CONFIG_MMC_SUNXI_SLOT          0
+#define CONFIG_MMC_SUNXI_USE_DMA
+#define CONFIG_ENV_IS_IN_MMC
+#define CONFIG_SYS_MMC_ENV_DEV         0       /* first detected MMC controller */
+
+/* 4MB of malloc() pool */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + (4 << 20))
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_CMD_ECHO
+#define CONFIG_SYS_CBSIZE      256     /* Console I/O Buffer Size */
+#define CONFIG_SYS_PBSIZE      384     /* Print Buffer Size */
+#define CONFIG_SYS_MAXARGS     16      /* max number of command args */
+#define CONFIG_SYS_GENERIC_BOARD
+
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
+
+#define CONFIG_SYS_LOAD_ADDR           0x48000000 /* default load address */
+
+/* standalone support */
+#define CONFIG_STANDALONE_LOAD_ADDR    0x48000000
+
+#define CONFIG_SYS_HZ                  1000
+
+/* baudrate */
+#define CONFIG_BAUDRATE                        115200
+
+/* The stack sizes are set up in start.S using the settings below */
+#define CONFIG_STACKSIZE               (256 << 10)     /* 256 KiB */
+
+/* FLASH and environment organization */
+
+#define CONFIG_SYS_NO_FLASH
+
+#define CONFIG_SYS_MONITOR_LEN         (512 << 10)     /* 512 KiB */
+#define CONFIG_IDENT_STRING            " Allwinner Technology"
+
+#define CONFIG_ENV_OFFSET              (544 << 10) /* (8 + 24 + 512) KiB */
+#define CONFIG_ENV_SIZE                        (128 << 10)     /* 128 KiB */
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+       "bootm_size=0x10000000\0"
+
+#define CONFIG_SYS_BOOT_GET_CMDLINE
+
+#include <config_cmd_default.h>
+
+#define CONFIG_FAT_WRITE       /* enable write access */
+
+#define CONFIG_SPL_FRAMEWORK
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+
+#ifdef CONFIG_SPL_FEL
+
+#define CONFIG_SPL
+#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl-fel.lds"
+#define CONFIG_SPL_START_S_PATH "arch/arm/cpu/armv7/sunxi"
+#define CONFIG_SPL_TEXT_BASE           0x2000
+#define CONFIG_SPL_MAX_SIZE            0x4000          /* 16 KiB */
+
+#else /* CONFIG_SPL */
+
+#define CONFIG_SPL_BSS_START_ADDR      0x4ff80000
+#define CONFIG_SPL_BSS_MAX_SIZE                0x80000         /* 512 KiB */
+
+#define CONFIG_SPL_TEXT_BASE           0x20            /* sram start+header */
+#define CONFIG_SPL_MAX_SIZE            0x5fe0          /* 24KB on sun4i/sun7i */
+
+#define CONFIG_SPL_LIBDISK_SUPPORT
+#define CONFIG_SPL_MMC_SUPPORT
+
+#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds"
+
+#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        80      /* 40KiB */
+#define CONFIG_SPL_PAD_TO              32768           /* decimal for 'dd' */
+
+#endif /* CONFIG_SPL */
+
+/* end of 32 KiB in sram */
+#define LOW_LEVEL_SRAM_STACK           0x00008000 /* End of sram */
+#define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
+#define CONFIG_SYS_SPL_MALLOC_START    0x4ff00000
+#define CONFIG_SYS_SPL_MALLOC_SIZE     0x00080000      /* 512 KiB */
+
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_NET
+#undef CONFIG_CMD_NFS
+
+#define CONFIG_CONS_INDEX              1       /* UART0 */
+
+#ifdef CONFIG_SUNXI_GMAC
+#define CONFIG_DESIGNWARE_ETH          /* GMAC can use designware driver */
+#define CONFIG_DW_AUTONEG
+#define CONFIG_PHY_GIGE                        /* GMAC can use gigabit PHY     */
+#define CONFIG_PHY_ADDR                1
+#define CONFIG_MII                     /* MII PHY management           */
+#define CONFIG_PHYLIB
+#endif
+
+#ifdef CONFIG_CMD_NET
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_DNS
+#define CONFIG_NETCONSOLE
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#endif
+
+#if !defined CONFIG_ENV_IS_IN_MMC && \
+    !defined CONFIG_ENV_IS_IN_NAND && \
+    !defined CONFIG_ENV_IS_IN_FAT && \
+    !defined CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_IS_NOWHERE
+#endif
+
+#ifndef CONFIG_SPL_BUILD
+#include <config_distro_defaults.h>
+#endif
+
+#endif /* _SUNXI_COMMON_CONFIG_H */
diff --git a/include/configs/tb100.h b/include/configs/tb100.h
new file mode 100644 (file)
index 0000000..8a861a8
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2011-2014 Pierrick Hascoet, Abilis Systems
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#ifndef _CONFIG_TB100_H_
+#define _CONFIG_TB100_H_
+
+#include <linux/sizes.h>
+
+/*
+ *  CPU configuration
+ */
+#define CONFIG_ARC700
+#define CONFIG_ARC_MMU_VER             3
+#define CONFIG_SYS_CACHELINE_SIZE      32
+#define CONFIG_SYS_CLK_FREQ            500000000
+#define CONFIG_SYS_TIMER_RATE          CONFIG_SYS_CLK_FREQ
+
+/*
+ * Board configuration
+ */
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_ARCH_EARLY_INIT_R
+
+/*
+ * Memory configuration
+ */
+#define CONFIG_SYS_TEXT_BASE           0x84000000
+#define CONFIG_SYS_MONITOR_BASE                CONFIG_SYS_TEXT_BASE
+
+#define CONFIG_SYS_DDR_SDRAM_BASE      0x80000000
+#define CONFIG_SYS_SDRAM_BASE          CONFIG_SYS_DDR_SDRAM_BASE
+#define CONFIG_SYS_SDRAM_SIZE          SZ_128M
+
+#define CONFIG_SYS_INIT_SP_ADDR                \
+       (CONFIG_SYS_SDRAM_BASE + 0x1000 - GENERATED_GBL_DATA_SIZE)
+
+#define CONFIG_SYS_MALLOC_LEN          SZ_128K
+#define CONFIG_SYS_BOOTM_LEN           SZ_32M
+#define CONFIG_SYS_LOAD_ADDR           0x82000000
+
+#define CONFIG_SYS_NO_FLASH
+
+/*
+ * UART configuration
+ */
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE    -4
+#define CONFIG_SYS_NS16550_CLK         166666666
+#define CONFIG_SYS_NS16550_COM1                0xFF100000
+#define CONFIG_SYS_NS16550_MEM32
+
+#define CONFIG_BAUDRATE                        115200
+
+/*
+ * Ethernet PHY configuration
+ */
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_GIGE
+
+/*
+ * Even though the board houses Realtek RTL8211E PHY
+ * corresponding PHY driver (drivers/net/phy/realtek.c) behaves unexpectedly.
+ * In particular "parse_status" reports link is down.
+ *
+ * Until Realtek PHY driver is fixed fall back to generic PHY driver
+ * which implements all required functionality and behaves much more stable.
+ *
+ * #define CONFIG_PHY_REALTEK
+ *
+ */
+
+/*
+ * Ethernet configuration
+ */
+#define CONFIG_DESIGNWARE_ETH
+#define ETH0_BASE_ADDRESS              0xFE100000
+#define ETH1_BASE_ADDRESS              0xFE110000
+
+/*
+ * Command line configuration
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_ELF
+#define CONFIG_CMD_PING
+
+#define CONFIG_OF_LIBFDT
+
+#define CONFIG_AUTO_COMPLETE
+#define CONFIG_SYS_MAXARGS             16
+
+/*
+ * Environment settings
+ */
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_ENV_SIZE                        SZ_2K
+#define CONFIG_ENV_OFFSET              0
+
+/*
+ * Environment configuration
+ */
+#define CONFIG_BOOTDELAY               3
+#define CONFIG_BOOTFILE                        "uImage"
+#define CONFIG_BOOTARGS                        "console=ttyS0,115200n8"
+#define CONFIG_LOADADDR                        CONFIG_SYS_LOAD_ADDR
+
+/*
+ * Console configuration
+ */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS_PROMPT              "[tb100]:~# "
+#define CONFIG_SYS_CBSIZE              256
+#define CONFIG_SYS_BARGSIZE            CONFIG_SYS_CBSIZE
+#define CONFIG_SYS_PBSIZE              (CONFIG_SYS_CBSIZE + \
+                                               sizeof(CONFIG_SYS_PROMPT) + 16)
+
+#endif /* _CONFIG_TB100_H_ */
index 14c6e675c1b8429b463d2b0672683a378f22581f..bef821f3371a2227dd505ba59e72c895cfd3d6af 100644 (file)
@@ -13,8 +13,6 @@
 
 /*--------------------------------------------------------------------------*/
 
-#define CONFIG_ARM926EJS               /* This is an ARM926EJS Core    */
-#define CONFIG_AT91FAMILY
 #define CONFIG_AT91SAM9263             /* It's an Atmel AT91SAM9263 SoC*/
 #define CONFIG_VL_MA2SC                        /* on an VL_MA2SC Board */
 #define CONFIG_ARCH_CPU_INIT
index 6e38d3c5b3a17dda60a2a934fc8ada4542e2e78b..a24fec6658e8e9bb1df82235222befc404411b32 100644 (file)
@@ -23,14 +23,14 @@ struct dm_demo_pdata {
 };
 
 struct demo_ops {
-       int (*hello)(struct device *dev, int ch);
-       int (*status)(struct device *dev, int *status);
+       int (*hello)(struct udevice *dev, int ch);
+       int (*status)(struct udevice *dev, int *status);
 };
 
-int demo_hello(struct device *dev, int ch);
-int demo_status(struct device *dev, int *status);
+int demo_hello(struct udevice *dev, int ch);
+int demo_status(struct udevice *dev, int *status);
 int demo_list(void);
 
-int demo_parse_dt(struct device *dev);
+int demo_parse_dt(struct udevice *dev);
 
 #endif
index c026e8e49c7088d132d08f3bbfc1bfe7324db296..ea3df36632d80fc907412e4d5c71771006206d53 100644 (file)
@@ -11,7 +11,7 @@
 #ifndef _DM_DEVICE_INTERNAL_H
 #define _DM_DEVICE_INTERNAL_H
 
-struct device;
+struct udevice;
 
 /**
  * device_bind() - Create a device and bind it to a driver
@@ -34,9 +34,9 @@ struct device;
  * @devp: Returns a pointer to the bound device
  * @return 0 if OK, -ve on error
  */
-int device_bind(struct device *parent, struct driver *drv,
+int device_bind(struct udevice *parent, struct driver *drv,
                const char *name, void *platdata, int of_offset,
-               struct device **devp);
+               struct udevice **devp);
 
 /**
  * device_bind_by_name: Create a device and bind it to a driver
@@ -49,8 +49,8 @@ int device_bind(struct device *parent, struct driver *drv,
  * @devp: Returns a pointer to the bound device
  * @return 0 if OK, -ve on error
  */
-int device_bind_by_name(struct device *parent, const struct driver_info *info,
-                       struct device **devp);
+int device_bind_by_name(struct udevice *parent, const struct driver_info *info,
+                       struct udevice **devp);
 
 /**
  * device_probe() - Probe a device, activating it
@@ -61,7 +61,7 @@ int device_bind_by_name(struct device *parent, const struct driver_info *info,
  * @dev: Pointer to device to probe
  * @return 0 if OK, -ve on error
  */
-int device_probe(struct device *dev);
+int device_probe(struct udevice *dev);
 
 /**
  * device_remove() - Remove a device, de-activating it
@@ -72,7 +72,7 @@ int device_probe(struct device *dev);
  * @dev: Pointer to device to remove
  * @return 0 if OK, -ve on error (an error here is normally a very bad thing)
  */
-int device_remove(struct device *dev);
+int device_remove(struct udevice *dev);
 
 /**
  * device_unbind() - Unbind a device, destroying it
@@ -82,6 +82,6 @@ int device_remove(struct device *dev);
  * @dev: Pointer to device to unbind
  * @return 0 if OK, -ve on error
  */
-int device_unbind(struct device *dev);
+int device_unbind(struct udevice *dev);
 
 #endif
index 4cd38ed2d030b84c34a10c2acf10f3808e21c645..ec049824e8cf485a07d5619963e6fafe56c345c6 100644 (file)
@@ -24,7 +24,7 @@ struct driver_info;
 #define DM_FLAG_ALLOC_PDATA    (2 << 0)
 
 /**
- * struct device - An instance of a driver
+ * struct udevice - An instance of a driver
  *
  * This holds information about a device, which is a driver bound to a
  * particular port or peripheral (essentially a driver instance).
@@ -53,12 +53,12 @@ struct driver_info;
  * @sibling_node: Next device in list of all devices
  * @flags: Flags for this device DM_FLAG_...
  */
-struct device {
+struct udevice {
        struct driver *driver;
        const char *name;
        void *platdata;
        int of_offset;
-       struct device *parent;
+       struct udevice *parent;
        void *priv;
        struct uclass *uclass;
        void *uclass_priv;
@@ -122,11 +122,11 @@ struct driver {
        char *name;
        enum uclass_id id;
        const struct device_id *of_match;
-       int (*bind)(struct device *dev);
-       int (*probe)(struct device *dev);
-       int (*remove)(struct device *dev);
-       int (*unbind)(struct device *dev);
-       int (*ofdata_to_platdata)(struct device *dev);
+       int (*bind)(struct udevice *dev);
+       int (*probe)(struct udevice *dev);
+       int (*remove)(struct udevice *dev);
+       int (*unbind)(struct udevice *dev);
+       int (*ofdata_to_platdata)(struct udevice *dev);
        int priv_auto_alloc_size;
        int platdata_auto_alloc_size;
        const void *ops;        /* driver-specific operations */
@@ -144,7 +144,7 @@ struct driver {
  * @dev                Device to check
  * @return platform data, or NULL if none
  */
-void *dev_get_platdata(struct device *dev);
+void *dev_get_platdata(struct udevice *dev);
 
 /**
  * dev_get_priv() - Get the private data for a device
@@ -154,6 +154,6 @@ void *dev_get_platdata(struct device *dev);
  * @dev                Device to check
  * @return private data, or NULL if none
  */
-void *dev_get_priv(struct device *dev);
+void *dev_get_priv(struct udevice *dev);
 
 #endif
index 0d09f9a14f5be00f9c79d1d3260e4347c00162dd..7feba4b00ff98df67a7affe486a567c60cb12f0e 100644 (file)
@@ -32,8 +32,8 @@ struct driver *lists_driver_lookup_name(const char *name);
  */
 struct uclass_driver *lists_uclass_lookup(enum uclass_id id);
 
-int lists_bind_drivers(struct device *parent);
+int lists_bind_drivers(struct udevice *parent);
 
-int lists_bind_fdt(struct device *parent, const void *blob, int offset);
+int lists_bind_fdt(struct udevice *parent, const void *blob, int offset);
 
 #endif
index 0ebccda355700ba77258c9fbce2c0364af31dd30..3018bc8627a54c132eed61f799c1ac0c594bfe6f 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef _DM_ROOT_H_
 #define _DM_ROOT_H_
 
-struct device;
+struct udevice;
 
 /**
  * dm_root() - Return pointer to the top of the driver tree
@@ -19,7 +19,7 @@ struct device;
  *
  * @return pointer to root device, or NULL if not inited yet
  */
-struct device *dm_root(void);
+struct udevice *dm_root(void);
 
 /**
  * dm_scan_platdata() - Scan all platform data and bind drivers
index eeaa2eb2f4645eb7aafff7c1e1626ffb8eae3b6c..409f1a3667fe3954b6164238b6ab2acccad2aa86 100644 (file)
@@ -30,7 +30,7 @@ struct dm_test_pdata {
  *     @return 0 if OK, -ve on error
  */
 struct test_ops {
-       int (*ping)(struct device *dev, int pingval, int *pingret);
+       int (*ping)(struct udevice *dev, int pingval, int *pingret);
 };
 
 /* Operations that our test driver supports */
@@ -102,8 +102,8 @@ extern struct dm_test_state global_test_state;
  * @skip_post_probe: Skip uclass post-probe processing
  */
 struct dm_test_state {
-       struct device *root;
-       struct device *testdev;
+       struct udevice *root;
+       struct udevice *testdev;
        int fail_count;
        int force_fail_alloc;
        int skip_post_probe;
@@ -138,8 +138,8 @@ struct dm_test {
        }
 
 /* Declare ping methods for the drivers */
-int test_ping(struct device *dev, int pingval, int *pingret);
-int testfdt_ping(struct device *dev, int pingval, int *pingret);
+int test_ping(struct udevice *dev, int pingval, int *pingret);
+int testfdt_ping(struct udevice *dev, int pingval, int *pingret);
 
 /**
  * dm_check_operations() - Check that we can perform ping operations
@@ -152,7 +152,7 @@ int testfdt_ping(struct device *dev, int pingval, int *pingret);
  * @priv: Pointer to private test information
  * @return 0 if OK, -ve on error
  */
-int dm_check_operations(struct dm_test_state *dms, struct device *dev,
+int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
                        uint32_t base, struct dm_test_priv *priv);
 
 /**
index cc65d5259f1e98fab78a877a816601cabecc1bed..1434db3eb4c75f5cacc4b219b1dff7090b8aace5 100644 (file)
@@ -21,7 +21,7 @@
  * @return the uclass pointer of a child at the given index or
  * return NULL on error.
  */
-int uclass_find_device(enum uclass_id id, int index, struct device **devp);
+int uclass_find_device(enum uclass_id id, int index, struct udevice **devp);
 
 /**
  * uclass_bind_device() - Associate device with a uclass
@@ -31,7 +31,7 @@ int uclass_find_device(enum uclass_id id, int index, struct device **devp);
  * @dev:       Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_bind_device(struct device *dev);
+int uclass_bind_device(struct udevice *dev);
 
 /**
  * uclass_unbind_device() - Deassociate device with a uclass
@@ -41,7 +41,7 @@ int uclass_bind_device(struct device *dev);
  * @dev:       Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_unbind_device(struct device *dev);
+int uclass_unbind_device(struct udevice *dev);
 
 /**
  * uclass_post_probe_device() - Deal with a device that has just been probed
@@ -52,7 +52,7 @@ int uclass_unbind_device(struct device *dev);
  * @dev:       Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_post_probe_device(struct device *dev);
+int uclass_post_probe_device(struct udevice *dev);
 
 /**
  * uclass_pre_remove_device() - Handle a device which is about to be removed
@@ -62,7 +62,7 @@ int uclass_post_probe_device(struct device *dev);
  * @dev:       Pointer to the device
  * #return 0 on success, -ve on error
  */
-int uclass_pre_remove_device(struct device *dev);
+int uclass_pre_remove_device(struct udevice *dev);
 
 /**
  * uclass_find() - Find uclass by its id
index cd23cfed163a8ea66fc6cc2275fdde705187c3fe..931d9c0b9a1f78cf099939abb2224ce7ba242c04 100644 (file)
@@ -37,7 +37,7 @@ struct uclass {
        struct list_head sibling_node;
 };
 
-struct device;
+struct udevice;
 
 /**
  * struct uclass_driver - Driver for the uclass
@@ -65,10 +65,10 @@ struct device;
 struct uclass_driver {
        const char *name;
        enum uclass_id id;
-       int (*post_bind)(struct device *dev);
-       int (*pre_unbind)(struct device *dev);
-       int (*post_probe)(struct device *dev);
-       int (*pre_remove)(struct device *dev);
+       int (*post_bind)(struct udevice *dev);
+       int (*pre_unbind)(struct udevice *dev);
+       int (*post_probe)(struct udevice *dev);
+       int (*pre_remove)(struct udevice *dev);
        int (*init)(struct uclass *class);
        int (*destroy)(struct uclass *class);
        int priv_auto_alloc_size;
@@ -101,7 +101,7 @@ int uclass_get(enum uclass_id key, struct uclass **ucp);
  * @ucp: Returns pointer to uclass (there is only one per for each ID)
  * @return 0 if OK, -ve on error
  */
-int uclass_get_device(enum uclass_id id, int index, struct device **ucp);
+int uclass_get_device(enum uclass_id id, int index, struct udevice **ucp);
 
 /**
  * uclass_first_device() - Get the first device in a uclass
@@ -110,7 +110,7 @@ int uclass_get_device(enum uclass_id id, int index, struct device **ucp);
  * @devp: Returns pointer to the first device in that uclass, or NULL if none
  * @return 0 if OK (found or not found), -1 on error
  */
-int uclass_first_device(enum uclass_id id, struct device **devp);
+int uclass_first_device(enum uclass_id id, struct udevice **devp);
 
 /**
  * uclass_next_device() - Get the next device in a uclass
@@ -119,7 +119,7 @@ int uclass_first_device(enum uclass_id id, struct device **devp);
  * to the next device in the same uclass, or NULL if none
  * @return 0 if OK (found or not found), -1 on error
  */
-int uclass_next_device(struct device **devp);
+int uclass_next_device(struct udevice **devp);
 
 /**
  * uclass_foreach_dev() - Helper function to iteration through devices
@@ -127,7 +127,7 @@ int uclass_next_device(struct device **devp);
  * This creates a for() loop which works through the available devices in
  * a uclass in order from start to end.
  *
- * @pos: struct device * to hold the current device. Set to NULL when there
+ * @pos: struct udevice * to hold the current device. Set to NULL when there
  * are no more devices.
  * uc: uclass to scan
  */
index 18861686cc139db06342d9ab8974f54ffa624d31..41e56abe15ce22e9244fc5ab348b26025f6463cd 100644 (file)
@@ -225,6 +225,7 @@ struct lmb;
 #define IH_TYPE_PBLIMAGE       15      /* Freescale PBL Boot Image     */
 #define IH_TYPE_MXSIMAGE       16      /* Freescale MXSBoot Image      */
 #define IH_TYPE_GPIMAGE                17      /* TI Keystone GPHeader Image   */
+#define IH_TYPE_ATMELIMAGE     18      /* ATMEL ROM bootable Image     */
 
 /*
  * Compression Types
index a8ae2787991fdbc84283b8488730cd70032ed43f..9980c74b51284a7549ec3c8f9cc1a64f13154dc8 100644 (file)
 #if defined(CONFIG_MPC8272_FAMILY)
 #ifdef CONFIG_MPC8247
 #define CPU_ID_STR     "MPC8247"
-#elif defined CONFIG_MPC8248
-#define CPU_ID_STR     "MPC8248"
-#elif defined CONFIG_MPC8271
-#define CPU_ID_STR     "MPC8271"
 #else
 #define CPU_ID_STR     "MPC8272"
 #endif
index e211f1841f60d7dac07d43d4dd9297a720854ac2..63481eca22688080f5b26e7da99013af88f06c1d 100644 (file)
@@ -78,6 +78,7 @@ int sh_eth_initialize(bd_t *bis);
 int skge_initialize(bd_t *bis);
 int smc91111_initialize(u8 dev_num, int base_addr);
 int smc911x_initialize(u8 dev_num, int base_addr);
+int sunxi_gmac_initialize(bd_t *bis);
 int sunxi_wemac_initialize(bd_t *bis);
 int tsi108_eth_initialize(bd_t *bis);
 int uec_standard_init(bd_t *bis);
index 55500fd8970042fb537d1df90f65529af2236877..bf677aa42a6027fb7a069f20507a793eea819df8 100644 (file)
@@ -183,12 +183,29 @@ MKIMAGEFLAGS_MLO.byteswap = -T omapimage -n byteswap -a $(CONFIG_SPL_TEXT_BASE)
 MLO MLO.byteswap: $(obj)/u-boot-spl.bin
        $(call if_changed,mkimage)
 
+MKIMAGEFLAGS_boot.bin = -T atmelimage
+
+ifeq ($(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER),y)
+MKIMAGEFLAGS_boot.bin += -n $(shell $(obj)/../tools/atmel_pmecc_params)
+
+boot.bin: $(obj)/../tools/atmel_pmecc_params
+endif
+
+boot.bin: $(obj)/u-boot-spl.bin
+       $(call if_changed,mkimage)
+
 ALL-y  += $(obj)/$(SPL_BIN).bin
 
 ifdef CONFIG_SAMSUNG
 ALL-y  += $(obj)/$(BOARD)-spl.bin
 endif
 
+ifdef CONFIG_SUNXI
+ifndef CONFIG_SPL_FEL
+ALL-y  += $(obj)/sunxi-spl.bin
+endif
+endif
+
 all:   $(ALL-y)
 
 ifdef CONFIG_SAMSUNG
@@ -216,6 +233,13 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),)
 LDFLAGS_$(SPL_BIN) += -Ttext $(CONFIG_SPL_TEXT_BASE)
 endif
 
+ifdef CONFIG_SUNXI
+quiet_cmd_mksunxiboot = MKSUNXI $@
+cmd_mksunxiboot = $(objtree)/tools/mksunxiboot $< $@
+$(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin
+       $(call if_changed,mksunxiboot)
+endif
+
 quiet_cmd_u-boot-spl = LD      $@
       cmd_u-boot-spl = cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
                       $(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \
index a03fe20f0d353cd48c3657b32a1a5aa9b2442a5a..083f15c31d137c6456ba457c9d2a6cab820653b6 100644 (file)
 #include <dm/test.h>
 #include <dm/uclass-internal.h>
 
-static int display_succ(struct device *in, char *buf)
+static int display_succ(struct udevice *in, char *buf)
 {
        int len;
        int ip = 0;
        char local[16];
-       struct device *pos, *n, *prev = NULL;
+       struct udevice *pos, *n, *prev = NULL;
 
        printf("%s- %s @ %08x", buf, in->name, map_to_sysmem(in));
        if (in->flags & DM_FLAG_ACTIVATED)
@@ -49,7 +49,7 @@ static int display_succ(struct device *in, char *buf)
        return 0;
 }
 
-static int dm_dump(struct device *dev)
+static int dm_dump(struct udevice *dev)
 {
        if (!dev)
                return -EINVAL;
@@ -59,7 +59,7 @@ static int dm_dump(struct device *dev)
 static int do_dm_dump_all(cmd_tbl_t *cmdtp, int flag, int argc,
                          char * const argv[])
 {
-       struct device *root;
+       struct udevice *root;
 
        root = dm_root();
        printf("ROOT %08x\n", map_to_sysmem(root));
@@ -74,7 +74,7 @@ static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int argc,
        int id;
 
        for (id = 0; id < UCLASS_COUNT; id++) {
-               struct device *dev;
+               struct udevice *dev;
 
                ret = uclass_get(id, &uc);
                if (ret)
index 14a57c3106d550138af6f23bd78f3e12551bb3bf..be3646b968b5ddc38a8c01a55e407cfdbb215ea5 100644 (file)
@@ -60,7 +60,7 @@ static struct driver_info driver_info_manual = {
 /* Test that binding with platdata occurs correctly */
 static int dm_test_autobind(struct dm_test_state *dms)
 {
-       struct device *dev;
+       struct udevice *dev;
 
        /*
         * We should have a single class (UCLASS_ROOT) and a single root
@@ -95,7 +95,7 @@ DM_TEST(dm_test_autobind, 0);
 static int dm_test_autoprobe(struct dm_test_state *dms)
 {
        int expected_base_add;
-       struct device *dev;
+       struct udevice *dev;
        struct uclass *uc;
        int i;
 
@@ -157,7 +157,7 @@ DM_TEST(dm_test_autoprobe, DM_TESTF_SCAN_PDATA);
 static int dm_test_platdata(struct dm_test_state *dms)
 {
        const struct dm_test_pdata *pdata;
-       struct device *dev;
+       struct udevice *dev;
        int i;
 
        for (i = 0; i < 3; i++) {
@@ -175,7 +175,7 @@ DM_TEST(dm_test_platdata, DM_TESTF_SCAN_PDATA);
 static int dm_test_lifecycle(struct dm_test_state *dms)
 {
        int op_count[DM_TEST_OP_COUNT];
-       struct device *dev, *test_dev;
+       struct udevice *dev, *test_dev;
        int pingret;
        int ret;
 
@@ -229,7 +229,7 @@ DM_TEST(dm_test_lifecycle, DM_TESTF_SCAN_PDATA | DM_TESTF_PROBE_TEST);
 /* Test that we can bind/unbind and the lists update correctly */
 static int dm_test_ordering(struct dm_test_state *dms)
 {
-       struct device *dev, *dev_penultimate, *dev_last, *test_dev;
+       struct udevice *dev, *dev_penultimate, *dev_last, *test_dev;
        int pingret;
 
        ut_assertok(device_bind_by_name(dms->root, &driver_info_manual,
@@ -281,7 +281,7 @@ static int dm_test_ordering(struct dm_test_state *dms)
 DM_TEST(dm_test_ordering, DM_TESTF_SCAN_PDATA);
 
 /* Check that we can perform operations on a device (do a ping) */
-int dm_check_operations(struct dm_test_state *dms, struct device *dev,
+int dm_check_operations(struct dm_test_state *dms, struct udevice *dev,
                        uint32_t base, struct dm_test_priv *priv)
 {
        int expected;
@@ -311,7 +311,7 @@ int dm_check_operations(struct dm_test_state *dms, struct device *dev,
 /* Check that we can perform operations on devices */
 static int dm_test_operations(struct dm_test_state *dms)
 {
-       struct device *dev;
+       struct udevice *dev;
        int i;
 
        /*
@@ -341,7 +341,7 @@ DM_TEST(dm_test_operations, DM_TESTF_SCAN_PDATA);
 /* Remove all drivers and check that things work */
 static int dm_test_remove(struct dm_test_state *dms)
 {
-       struct device *dev;
+       struct udevice *dev;
        int i;
 
        for (i = 0; i < 3; i++) {
@@ -367,7 +367,7 @@ static int dm_test_leak(struct dm_test_state *dms)
 
        for (i = 0; i < 2; i++) {
                struct mallinfo start, end;
-               struct device *dev;
+               struct udevice *dev;
                int ret;
                int id;
 
@@ -435,10 +435,10 @@ DM_TEST(dm_test_uclass, 0);
  *             this array.
  * @return 0 if OK, -ve on error
  */
-static int create_children(struct dm_test_state *dms, struct device *parent,
-                          int count, int key, struct device *child[])
+static int create_children(struct dm_test_state *dms, struct udevice *parent,
+                          int count, int key, struct udevice *child[])
 {
-       struct device *dev;
+       struct udevice *dev;
        int i;
 
        for (i = 0; i < count; i++) {
@@ -460,10 +460,10 @@ static int create_children(struct dm_test_state *dms, struct device *parent,
 
 static int dm_test_children(struct dm_test_state *dms)
 {
-       struct device *top[NODE_COUNT];
-       struct device *child[NODE_COUNT];
-       struct device *grandchild[NODE_COUNT];
-       struct device *dev;
+       struct udevice *top[NODE_COUNT];
+       struct udevice *child[NODE_COUNT];
+       struct udevice *grandchild[NODE_COUNT];
+       struct udevice *dev;
        int total;
        int ret;
        int i;
index bf632bca54ed3e96b05419fe6a4d6695e6541b44..2b2b0b51fa74571a0e0ca200574bef48c0d7dee7 100644 (file)
@@ -17,7 +17,7 @@ static int dm_test_gpio(struct dm_test_state *dms)
 {
        unsigned int offset, gpio;
        struct dm_gpio_ops *ops;
-       struct device *dev;
+       struct udevice *dev;
        const char *name;
        int offset_count;
        char buf[80];
index c4be8a12d71a5518cdc735f821c6e459e25370bd..0f1a37b36e52faabdba5b2a78e28a33852600c4f 100644 (file)
@@ -18,7 +18,7 @@
 int dm_testdrv_op_count[DM_TEST_OP_COUNT];
 static struct dm_test_state *dms = &global_test_state;
 
-static int testdrv_ping(struct device *dev, int pingval, int *pingret)
+static int testdrv_ping(struct udevice *dev, int pingval, int *pingret)
 {
        const struct dm_test_pdata *pdata = dev_get_platdata(dev);
        struct dm_test_priv *priv = dev_get_priv(dev);
@@ -33,7 +33,7 @@ static const struct test_ops test_ops = {
        .ping = testdrv_ping,
 };
 
-static int test_bind(struct device *dev)
+static int test_bind(struct udevice *dev)
 {
        /* Private data should not be allocated */
        ut_assert(!dev_get_priv(dev));
@@ -42,7 +42,7 @@ static int test_bind(struct device *dev)
        return 0;
 }
 
-static int test_probe(struct device *dev)
+static int test_probe(struct udevice *dev)
 {
        struct dm_test_priv *priv = dev_get_priv(dev);
 
@@ -54,7 +54,7 @@ static int test_probe(struct device *dev)
        return 0;
 }
 
-static int test_remove(struct device *dev)
+static int test_remove(struct udevice *dev)
 {
        /* Private data should still be allocated */
        ut_assert(dev_get_priv(dev));
@@ -63,7 +63,7 @@ static int test_remove(struct device *dev)
        return 0;
 }
 
-static int test_unbind(struct device *dev)
+static int test_unbind(struct udevice *dev)
 {
        /* Private data should not be allocated */
        ut_assert(!dev->priv);
@@ -94,7 +94,7 @@ U_BOOT_DRIVER(test2_drv) = {
        .priv_auto_alloc_size = sizeof(struct dm_test_priv),
 };
 
-static int test_manual_drv_ping(struct device *dev, int pingval, int *pingret)
+static int test_manual_drv_ping(struct udevice *dev, int pingval, int *pingret)
 {
        *pingret = pingval + 2;
 
@@ -105,14 +105,14 @@ static const struct test_ops test_manual_ops = {
        .ping = test_manual_drv_ping,
 };
 
-static int test_manual_bind(struct device *dev)
+static int test_manual_bind(struct udevice *dev)
 {
        dm_testdrv_op_count[DM_TEST_OP_BIND]++;
 
        return 0;
 }
 
-static int test_manual_probe(struct device *dev)
+static int test_manual_probe(struct udevice *dev)
 {
        dm_testdrv_op_count[DM_TEST_OP_PROBE]++;
        if (!dms->force_fail_alloc)
@@ -123,13 +123,13 @@ static int test_manual_probe(struct device *dev)
        return 0;
 }
 
-static int test_manual_remove(struct device *dev)
+static int test_manual_remove(struct udevice *dev)
 {
        dm_testdrv_op_count[DM_TEST_OP_REMOVE]++;
        return 0;
 }
 
-static int test_manual_unbind(struct device *dev)
+static int test_manual_unbind(struct udevice *dev)
 {
        dm_testdrv_op_count[DM_TEST_OP_UNBIND]++;
        return 0;
index e1d982fd7d164391e958c2e608dc03e5f1bb6a57..6eccf111279c2bbee53417f508c6b3ed514b8156 100644 (file)
@@ -18,7 +18,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int testfdt_drv_ping(struct device *dev, int pingval, int *pingret)
+static int testfdt_drv_ping(struct udevice *dev, int pingval, int *pingret)
 {
        const struct dm_test_pdata *pdata = dev->platdata;
        struct dm_test_priv *priv = dev_get_priv(dev);
@@ -33,7 +33,7 @@ static const struct test_ops test_ops = {
        .ping = testfdt_drv_ping,
 };
 
-static int testfdt_ofdata_to_platdata(struct device *dev)
+static int testfdt_ofdata_to_platdata(struct udevice *dev)
 {
        struct dm_test_pdata *pdata = dev_get_platdata(dev);
 
@@ -44,7 +44,7 @@ static int testfdt_ofdata_to_platdata(struct device *dev)
        return 0;
 }
 
-static int testfdt_drv_probe(struct device *dev)
+static int testfdt_drv_probe(struct udevice *dev)
 {
        struct dm_test_priv *priv = dev_get_priv(dev);
 
@@ -75,7 +75,7 @@ U_BOOT_DRIVER(testfdt_drv) = {
 };
 
 /* From here is the testfdt uclass code */
-int testfdt_ping(struct device *dev, int pingval, int *pingret)
+int testfdt_ping(struct udevice *dev, int pingval, int *pingret)
 {
        const struct test_ops *ops = device_get_ops(dev);
 
@@ -94,7 +94,7 @@ UCLASS_DRIVER(testfdt) = {
 static int dm_test_fdt(struct dm_test_state *dms)
 {
        const int num_drivers = 3;
-       struct device *dev;
+       struct udevice *dev;
        struct uclass *uc;
        int ret;
        int i;
index 828ed46f8e79ec9205890f20c40a1c7d7935ffd7..fbdae688e09274842ecf197444caea76bc5e4caa 100644 (file)
@@ -32,7 +32,7 @@ static int dm_test_init(struct dm_test_state *dms)
 /* Ensure all the test devices are probed */
 static int do_autoprobe(struct dm_test_state *dms)
 {
-       struct device *dev;
+       struct udevice *dev;
        int ret;
 
        /* Scanning the uclass is enough to probe all the devices */
index 8b564b89d98ced370c0f524f2f0752154674a9bf..017e097928c7c29c2aadfd0c80f187833d258574 100644 (file)
@@ -18,7 +18,7 @@
 
 static struct dm_test_state *dms = &global_test_state;
 
-int test_ping(struct device *dev, int pingval, int *pingret)
+int test_ping(struct udevice *dev, int pingval, int *pingret)
 {
        const struct test_ops *ops = device_get_ops(dev);
 
@@ -28,24 +28,25 @@ int test_ping(struct device *dev, int pingval, int *pingret)
        return ops->ping(dev, pingval, pingret);
 }
 
-static int test_post_bind(struct device *dev)
+static int test_post_bind(struct udevice *dev)
 {
        dm_testdrv_op_count[DM_TEST_OP_POST_BIND]++;
 
        return 0;
 }
 
-static int test_pre_unbind(struct device *dev)
+static int test_pre_unbind(struct udevice *dev)
 {
        dm_testdrv_op_count[DM_TEST_OP_PRE_UNBIND]++;
 
        return 0;
 }
 
-static int test_post_probe(struct device *dev)
+static int test_post_probe(struct udevice *dev)
 {
-       struct device *prev = list_entry(dev->uclass_node.prev, struct device,
-                                        uclass_node);
+       struct udevice *prev = list_entry(dev->uclass_node.prev,
+                                           struct udevice, uclass_node);
+
        struct dm_test_uclass_perdev_priv *priv = dev->uclass_priv;
        struct uclass *uc = dev->uclass;
 
@@ -68,7 +69,7 @@ static int test_post_probe(struct device *dev)
        return 0;
 }
 
-static int test_pre_remove(struct device *dev)
+static int test_pre_remove(struct udevice *dev)
 {
        dm_testdrv_op_count[DM_TEST_OP_PRE_REMOVE]++;
 
index b1e997fc3ee0018efb954ad858201e01ca3c3d82..725db906e840a3c2a035d05b67a93c110072e944 100644 (file)
@@ -11,6 +11,7 @@
 /mkexynosspl
 /mpc86x_clk
 /mxsboot
+/mksunxiboot
 /ncb
 /proftool
 /relocate-rela
index 6e43a0150d41d200bdd4097bcdc2c5a3af792277..761055764bf6ab1e27bd8f4c27602879244effe6 100644 (file)
@@ -38,6 +38,8 @@ ENVCRC-$(CONFIG_ENV_IS_IN_NVRAM) = y
 ENVCRC-$(CONFIG_ENV_IS_IN_SPI_FLASH) = y
 CONFIG_BUILD_ENVCRC ?= $(ENVCRC-y)
 
+hostprogs-$(CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER) += atmel_pmecc_params$(SFX)
+
 # TODO: CONFIG_CMD_LICENSE does not work
 hostprogs-$(CONFIG_CMD_LICENSE) += bin2header$(SFX)
 hostprogs-$(CONFIG_LCD_LOGO) += bmp_logo$(SFX)
@@ -69,6 +71,7 @@ RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := rsa-sign.o rsa-verify.o rsa-checksum.o
 
 # common objs for dumpimage and mkimage
 dumpimage-mkimage-objs := aisimage.o \
+                       atmelimage.o \
                        $(FIT_SIG_OBJS-y) \
                        crc32.o \
                        default_image.o \
@@ -131,6 +134,8 @@ hostprogs-$(CONFIG_MX23) += mxsboot$(SFX)
 hostprogs-$(CONFIG_MX28) += mxsboot$(SFX)
 HOSTCFLAGS_mxsboot$(SFX).o := -pedantic
 
+hostprogs-$(CONFIG_SUNXI) += mksunxiboot$(SFX)
+
 hostprogs-$(CONFIG_NETCONSOLE) += ncb$(SFX)
 hostprogs-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX)
 
diff --git a/tools/atmel_pmecc_params.c b/tools/atmel_pmecc_params.c
new file mode 100644 (file)
index 0000000..8eaf27f
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * (C) Copyright 2014 Andreas Bießmann <andreas.devel@googlemail.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+/*
+ * This is a host tool for generating an appropriate string out of board
+ * configuration. The string is required for correct generation of PMECC
+ * header which in turn is required for NAND flash booting of Atmel AT91 style
+ * hardware.
+ *
+ * See doc/README.atmel_pmecc for more information.
+ */
+
+#include <config.h>
+#include <stdlib.h>
+
+static int pmecc_get_ecc_bytes(int cap, int sector_size)
+{
+       int m = 12 + sector_size / 512;
+       return (m * cap + 7) / 8;
+}
+
+int main(int argc, char *argv[])
+{
+       unsigned int use_pmecc = 0;
+       unsigned int sector_per_page;
+       unsigned int sector_size = CONFIG_PMECC_SECTOR_SIZE;
+       unsigned int oob_size = CONFIG_SYS_NAND_OOBSIZE;
+       unsigned int ecc_bits = CONFIG_PMECC_CAP;
+       unsigned int ecc_offset;
+
+#ifdef CONFIG_ATMEL_NAND_HW_PMECC
+       use_pmecc = 1;
+#endif
+
+       sector_per_page = CONFIG_SYS_NAND_PAGE_SIZE / CONFIG_PMECC_SECTOR_SIZE;
+       ecc_offset = oob_size -
+               pmecc_get_ecc_bytes(ecc_bits, sector_size) * sector_per_page;
+
+       printf("usePmecc=%d,", use_pmecc);
+       printf("sectorPerPage=%d,", sector_per_page);
+       printf("sectorSize=%d,", sector_size);
+       printf("spareSize=%d,", oob_size);
+       printf("eccBits=%d,", ecc_bits);
+       printf("eccOffset=%d", ecc_offset);
+       printf("\n");
+
+       exit(EXIT_SUCCESS);
+}
diff --git a/tools/atmelimage.c b/tools/atmelimage.c
new file mode 100644 (file)
index 0000000..c8101d2
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+ * (C) Copyright 2014
+ * Andreas Bießmann <andreas.devel@googlemail.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include "imagetool.h"
+#include "mkimage.h"
+
+#include <image.h>
+
+#define pr_err(fmt, args...) fprintf(stderr, "atmelimage Error: " fmt, ##args)
+
+static int atmel_check_image_type(uint8_t type)
+{
+       if (type == IH_TYPE_ATMELIMAGE)
+               return EXIT_SUCCESS;
+       else
+               return EXIT_FAILURE;
+}
+
+static uint32_t nand_pmecc_header[52];
+
+/*
+ * A helper struct for parsing the mkimage -n parameter
+ *
+ * Keep in same order as the configs array!
+ */
+static struct pmecc_config {
+       int use_pmecc;
+       int sector_per_page;
+       int spare_size;
+       int ecc_bits;
+       int sector_size;
+       int ecc_offset;
+} pmecc;
+
+/*
+ * Strings used for configure the PMECC header via -n mkimage switch
+ *
+ * We estimate a coma separated list of key=value pairs. The mkimage -n
+ * parameter argument should not contain any whitespace.
+ *
+ * Keep in same order as struct pmecc_config!
+ */
+static const char * const configs[] = {
+       "usePmecc",
+       "sectorPerPage",
+       "spareSize",
+       "eccBits",
+       "sectorSize",
+       "eccOffset"
+};
+
+static int atmel_find_pmecc_parameter_in_token(const char *token)
+{
+       size_t pos;
+       char *param;
+
+       debug("token: '%s'\n", token);
+
+       for (pos = 0; pos < ARRAY_SIZE(configs); pos++) {
+               if (strncmp(token, configs[pos], strlen(configs[pos])) == 0) {
+                       param = strstr(token, "=");
+                       if (!param)
+                               goto err;
+
+                       param++;
+                       debug("\t%s parameter: '%s'\n", configs[pos], param);
+
+                       switch (pos) {
+                       case 0:
+                               pmecc.use_pmecc = strtol(param, NULL, 10);
+                               return EXIT_SUCCESS;
+                       case 1:
+                               pmecc.sector_per_page = strtol(param, NULL, 10);
+                               return EXIT_SUCCESS;
+                       case 2:
+                               pmecc.spare_size = strtol(param, NULL, 10);
+                               return EXIT_SUCCESS;
+                       case 3:
+                               pmecc.ecc_bits = strtol(param, NULL, 10);
+                               return EXIT_SUCCESS;
+                       case 4:
+                               pmecc.sector_size = strtol(param, NULL, 10);
+                               return EXIT_SUCCESS;
+                       case 5:
+                               pmecc.ecc_offset = strtol(param, NULL, 10);
+                               return EXIT_SUCCESS;
+                       }
+               }
+       }
+
+err:
+       pr_err("Could not find parameter in token '%s'\n", token);
+       return EXIT_FAILURE;
+}
+
+static int atmel_parse_pmecc_params(char *txt)
+{
+       char *token;
+
+       token = strtok(txt, ",");
+       while (token != NULL) {
+               if (atmel_find_pmecc_parameter_in_token(token))
+                       return EXIT_FAILURE;
+
+               token = strtok(NULL, ",");
+       }
+
+       return EXIT_SUCCESS;
+}
+
+static int atmel_verify_header(unsigned char *ptr, int image_size,
+                       struct image_tool_params *params)
+{
+       uint32_t *ints = (uint32_t *)ptr;
+       size_t pos;
+       size_t size = image_size;
+
+       /* check if we have an PMECC header attached */
+       for (pos = 0; pos < ARRAY_SIZE(nand_pmecc_header); pos++)
+               if (ints[pos] >> 28 != 0xC)
+                       break;
+
+       if (pos == ARRAY_SIZE(nand_pmecc_header)) {
+               ints += ARRAY_SIZE(nand_pmecc_header);
+               size -= sizeof(nand_pmecc_header);
+       }
+
+       /* check the seven interrupt vectors of binary */
+       for (pos = 0; pos < 7; pos++) {
+               debug("atmelimage: interrupt vector #%d is 0x%08X\n", pos+1,
+                     ints[pos]);
+               /*
+                * all vectors except the 6'th one must contain valid
+                * LDR or B Opcode
+                */
+               if (pos == 5)
+                       /* 6'th vector has image size set, check later */
+                       continue;
+               if ((ints[pos] & 0xff000000) == 0xea000000)
+                       /* valid B Opcode */
+                       continue;
+               if ((ints[pos] & 0xfffff000) == 0xe59ff000)
+                       /* valid LDR (I=0, P=1, U=1, B=0, W=0, L=1) */
+                       continue;
+               /* ouch, one of the checks has missed ... */
+               return 1;
+       }
+
+       return ints[5] != cpu_to_le32(size);
+}
+
+static void atmel_print_pmecc_header(const uint32_t word)
+{
+       int val;
+
+       printf("\t\tPMECC header\n");
+
+       printf("\t\t====================\n");
+
+       val = (word >> 18) & 0x1ff;
+       printf("\t\teccOffset: %9i\n", val);
+
+       val = (((word >> 16) & 0x3) == 0) ? 512 : 1024;
+       printf("\t\tsectorSize: %8i\n", val);
+
+       if (((word >> 13) & 0x7) <= 2)
+               val = (2 << ((word >> 13) & 0x7));
+       else
+               val = (12 << (((word >> 13) & 0x7) - 3));
+       printf("\t\teccBitReq: %9i\n", val);
+
+       val = (word >> 4) & 0x1ff;
+       printf("\t\tspareSize: %9i\n", val);
+
+       val = (1 << ((word >> 1) & 0x3));
+       printf("\t\tnbSectorPerPage: %3i\n", val);
+
+       printf("\t\tusePmecc: %10i\n", word & 0x1);
+       printf("\t\t====================\n");
+}
+
+static void atmel_print_header(const void *ptr)
+{
+       uint32_t *ints = (uint32_t *)ptr;
+       size_t pos;
+
+       /* check if we have an PMECC header attached */
+       for (pos = 0; pos < ARRAY_SIZE(nand_pmecc_header); pos++)
+               if (ints[pos] >> 28 != 0xC)
+                       break;
+
+       if (pos == ARRAY_SIZE(nand_pmecc_header)) {
+               printf("Image Type:\tATMEL ROM-Boot Image with PMECC Header\n");
+               atmel_print_pmecc_header(ints[0]);
+               pos += 5;
+       } else {
+               printf("Image Type:\tATMEL ROM-Boot Image without PMECC Header\n");
+               pos = 5;
+       }
+       printf("\t\t6'th vector has %u set\n", le32_to_cpu(ints[pos]));
+}
+
+static void atmel_set_header(void *ptr, struct stat *sbuf, int ifd,
+                               struct image_tool_params *params)
+{
+       /* just save the image size into 6'th interrupt vector */
+       uint32_t *ints = (uint32_t *)ptr;
+       size_t cnt;
+       size_t pos = 5;
+       size_t size = sbuf->st_size;
+
+       for (cnt = 0; cnt < ARRAY_SIZE(nand_pmecc_header); cnt++)
+               if (ints[cnt] >> 28 != 0xC)
+                       break;
+
+       if (cnt == ARRAY_SIZE(nand_pmecc_header)) {
+               pos += ARRAY_SIZE(nand_pmecc_header);
+               size -= sizeof(nand_pmecc_header);
+       }
+
+       ints[pos] = cpu_to_le32(size);
+}
+
+static int atmel_check_params(struct image_tool_params *params)
+{
+       if (strlen(params->imagename) > 0)
+               if (atmel_parse_pmecc_params(params->imagename))
+                       return EXIT_FAILURE;
+
+       return !(!params->eflag &&
+               !params->fflag &&
+               !params->xflag &&
+               ((params->dflag && !params->lflag) ||
+                (params->lflag && !params->dflag)));
+}
+
+static int atmel_vrec_header(struct image_tool_params *params,
+                               struct image_type_params *tparams)
+{
+       uint32_t tmp;
+       size_t pos;
+
+       if (strlen(params->imagename) == 0)
+               return EXIT_SUCCESS;
+
+       tmp = 0xC << 28;
+
+       tmp |= (pmecc.ecc_offset & 0x1ff) << 18;
+
+       switch (pmecc.sector_size) {
+       case 512:
+               tmp |= 0 << 16;
+               break;
+       case 1024:
+               tmp |= 1 << 16;
+               break;
+
+       default:
+               pr_err("Wrong sectorSize (%i) for PMECC header\n",
+                      pmecc.sector_size);
+               return EXIT_FAILURE;
+       }
+
+       switch (pmecc.ecc_bits) {
+       case 2:
+               tmp |= 0 << 13;
+               break;
+       case 4:
+               tmp |= 1 << 13;
+               break;
+       case 8:
+               tmp |= 2 << 13;
+               break;
+       case 12:
+               tmp |= 3 << 13;
+               break;
+       case 24:
+               tmp |= 4 << 13;
+               break;
+
+       default:
+               pr_err("Wrong eccBits (%i) for PMECC header\n",
+                      pmecc.ecc_bits);
+                return EXIT_FAILURE;
+       }
+
+       tmp |= (pmecc.spare_size & 0x1ff) << 4;
+
+       switch (pmecc.sector_per_page) {
+       case 1:
+               tmp |= 0 << 1;
+               break;
+       case 2:
+               tmp |= 1 << 1;
+               break;
+       case 4:
+               tmp |= 2 << 1;
+               break;
+       case 8:
+               tmp |= 3 << 1;
+               break;
+
+       default:
+               pr_err("Wrong sectorPerPage (%i) for PMECC header\n",
+                      pmecc.sector_per_page);
+               return EXIT_FAILURE;
+       }
+
+       if (pmecc.use_pmecc)
+               tmp |= 1;
+
+       for (pos = 0; pos < ARRAY_SIZE(nand_pmecc_header); pos++)
+               nand_pmecc_header[pos] = tmp;
+
+       debug("PMECC header filled 52 times with 0x%08X\n", tmp);
+
+       tparams->header_size = sizeof(nand_pmecc_header);
+       tparams->hdr = nand_pmecc_header;
+
+       return EXIT_SUCCESS;
+}
+
+static struct image_type_params atmelimage_params = {
+       .name           = "ATMEL ROM-Boot Image support",
+       .header_size    = 0,
+       .hdr            = NULL,
+       .check_image_type = atmel_check_image_type,
+       .verify_header  = atmel_verify_header,
+       .print_header   = atmel_print_header,
+       .set_header     = atmel_set_header,
+       .check_params   = atmel_check_params,
+       .vrec_header    = atmel_vrec_header,
+};
+
+void init_atmel_image_type(void)
+{
+       register_image_type(&atmelimage_params);
+}
index da72115e53230a53444078df089186d932bec54b..32d6278edb95fe8be0a8d17a0050e7c84d72c8d4 100644 (file)
@@ -27,6 +27,8 @@ void register_image_tool(imagetool_register_t image_register)
         */
        register_func = image_register;
 
+       /* Init ATMEL ROM Boot Image generation/list support */
+       init_atmel_image_type();
        /* Init Freescale PBL Boot image generation/list support */
        init_pbl_image_type();
        /* Init Kirkwood Boot image generation/list support */
index a3e9d302eb3f9de7324a5055521b9008b24bcfa5..c480687ec13884c43cb99ac39a977847198aa375 100644 (file)
@@ -159,6 +159,7 @@ void register_image_type(struct image_type_params *tparams);
  * Supported image types init functions
  */
 void init_default_image_type(void);
+void init_atmel_image_type(void);
 void init_pbl_image_type(void);
 void init_ais_image_type(void);
 void init_kwb_image_type(void);
diff --git a/tools/mksunxiboot.c b/tools/mksunxiboot.c
new file mode 100644 (file)
index 0000000..da7c9f0
--- /dev/null
@@ -0,0 +1,142 @@
+/*
+ * (C) Copyright 2007-2011
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ * Tom Cubie <tangliang@allwinnertech.com>
+ *
+ * a simple tool to generate bootable image for sunxi platform.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/* boot head definition from sun4i boot code */
+struct boot_file_head {
+       uint32_t b_instruction; /* one intruction jumping to real code */
+       uint8_t magic[8];       /* ="eGON.BT0" or "eGON.BT1", not C-style str */
+       uint32_t check_sum;     /* generated by PC */
+       uint32_t length;        /* generated by PC */
+       /*
+        * We use a simplified header, only filling in what is needed
+        * by the boot ROM. To be compatible with Allwinner tools we
+        * would need to implement the proper fields here instead of
+        * padding.
+        */
+       uint8_t pad[12];                /* align to 32 bytes */
+};
+
+#define BOOT0_MAGIC                     "eGON.BT0"
+#define STAMP_VALUE                     0x5F0A6C39
+
+/* check sum functon from sun4i boot code */
+int gen_check_sum(struct boot_file_head *head_p)
+{
+       uint32_t length;
+       uint32_t *buf;
+       uint32_t loop;
+       uint32_t i;
+       uint32_t sum;
+
+       length = head_p->length;
+       if ((length & 0x3) != 0)        /* must 4-byte-aligned */
+               return -1;
+       buf = (uint32_t *)head_p;
+       head_p->check_sum = STAMP_VALUE;        /* fill stamp */
+       loop = length >> 2;
+
+       /* calculate the sum */
+       for (i = 0, sum = 0; i < loop; i++)
+               sum += buf[i];
+
+       /* write back check sum */
+       head_p->check_sum = sum;
+
+       return 0;
+}
+
+#define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a)-1)
+#define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask))
+
+#define SUN4I_SRAM_SIZE 0x7600 /* 0x7748+ is used by BROM */
+#define SRAM_LOAD_MAX_SIZE (SUN4I_SRAM_SIZE - sizeof(struct boot_file_head))
+#define BLOCK_SIZE 512
+
+struct boot_img {
+       struct boot_file_head header;
+       char code[SRAM_LOAD_MAX_SIZE];
+       char pad[BLOCK_SIZE];
+};
+
+int main(int argc, char *argv[])
+{
+       int fd_in, fd_out;
+       struct boot_img img;
+       unsigned file_size, load_size;
+       int count;
+
+       if (argc < 2) {
+               printf("\tThis program makes an input bin file to sun4i " \
+                      "bootable image.\n" \
+                      "\tUsage: %s input_file out_putfile\n", argv[0]);
+               return EXIT_FAILURE;
+       }
+
+       fd_in = open(argv[1], O_RDONLY);
+       if (fd_in < 0) {
+               perror("Open input file");
+               return EXIT_FAILURE;
+       }
+
+       memset(img.pad, 0, BLOCK_SIZE);
+
+       /* get input file size */
+       file_size = lseek(fd_in, 0, SEEK_END);
+
+       if (file_size > SRAM_LOAD_MAX_SIZE) {
+               fprintf(stderr, "ERROR: File too large!\n");
+               return EXIT_FAILURE;
+       } else {
+               load_size = ALIGN(file_size, sizeof(int));
+       }
+
+       fd_out = open(argv[2], O_WRONLY | O_CREAT, 0666);
+       if (fd_out < 0) {
+               perror("Open output file");
+               return EXIT_FAILURE;
+       }
+
+       /* read file to buffer to calculate checksum */
+       lseek(fd_in, 0, SEEK_SET);
+       count = read(fd_in, img.code, load_size);
+       if (count != load_size) {
+               perror("Reading input image");
+               return EXIT_FAILURE;
+       }
+
+       /* fill the header */
+       img.header.b_instruction =      /* b instruction */
+               0xEA000000 |    /* jump to the first instr after the header */
+               ((sizeof(struct boot_file_head) / sizeof(int) - 2)
+                & 0x00FFFFFF);
+       memcpy(img.header.magic, BOOT0_MAGIC, 8);       /* no '0' termination */
+       img.header.length =
+               ALIGN(load_size + sizeof(struct boot_file_head), BLOCK_SIZE);
+       gen_check_sum(&img.header);
+
+       count = write(fd_out, &img, img.header.length);
+       if (count != img.header.length) {
+               perror("Writing output");
+               return EXIT_FAILURE;
+       }
+
+       close(fd_in);
+       close(fd_out);
+
+       return EXIT_SUCCESS;
+}