Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
authorWolfgang Denk <wd@denx.de>
Mon, 30 Apr 2012 14:45:56 +0000 (16:45 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 30 Apr 2012 14:45:56 +0000 (16:45 +0200)
* 'master' of git://git.denx.de/u-boot-mpc85xx:
  powerpc/85xx: don't touch MAS7 on e500v1 when relocating CCSR
  powerpc/85xx: don't display address map size (32-bit vs. 36-bit) during boot
  cmd_bdinfo: display the address map size (32-bit vs. 36-bit)
  PowerPC: correct the SATA for p1/p2 rdb-pc platform
  powerpc/corenet_ds: Slave core in holdoff when boot from SRIO
  powerpc/corenet_ds: Slave reads ENV from master when boot from SRIO
  powerpc/corenet_ds: Slave uploads ucode when boot from SRIO
  powerpc/corenet_ds: Slave module for boot from SRIO
  powerpc/corenet_ds: Master module for boot from SRIO
  powerpc/corenet_ds: Document for the boot from SRIO
  powerpc/corenet_ds: Correct the compilation errors about ENV
  powerpc/srio: Rewrite the struct ccsr_rio
  powerpc/85xx:Fix lds for nand boot debug info
  powerpc/p2041rdb: add env in NAND support
  powerpc/p2041rdb: add NAND and NAND boot support
  powerpc/mpc8xxx: Fix CONFIG_DDR_RAW_TIMING for two boards
  powerpc/85xx:Avoid vector table compilation for nand_spl
  powerpc/85xx:Fix IVORs addr after vector table relocation
  powerpc/85xx:Avoid hardcoded vector address for IVORs
  powerpc/p1023rds: Disable nor flash node and enable nand flash node

54 files changed:
MAINTAINERS
Makefile
README
arch/arm/cpu/armv7/omap-common/spl_nand.c
arch/arm/include/asm/arch-spear/spr_i2c.h [deleted file]
arch/blackfin/include/asm/config.h
arch/blackfin/include/asm/global_data.h
arch/blackfin/lib/board.c
arch/nds32/cpu/n1213/ag102/Makefile [new file with mode: 0644]
arch/nds32/cpu/n1213/ag102/asm-offsets.c [new file with mode: 0644]
arch/nds32/cpu/n1213/ag102/cpu.c [new file with mode: 0644]
arch/nds32/cpu/n1213/ag102/lowlevel_init.S [new file with mode: 0644]
arch/nds32/cpu/n1213/ag102/timer.c [new file with mode: 0644]
arch/nds32/cpu/n1213/ag102/watchdog.S [new file with mode: 0644]
arch/nds32/include/asm/arch-ag102/ag102.h [new file with mode: 0644]
arch/nds32/include/asm/mach-types.h
board/AndesTech/adp-ag102/Makefile [new file with mode: 0644]
board/AndesTech/adp-ag102/adp-ag102.c [new file with mode: 0644]
boards.cfg
common/cmd_nand.c
doc/README.ag102 [new file with mode: 0644]
drivers/i2c/Makefile
drivers/i2c/designware_i2c.c [new file with mode: 0644]
drivers/i2c/designware_i2c.h [new file with mode: 0644]
drivers/i2c/sh_sh7734_i2c.c [new file with mode: 0644]
drivers/i2c/spr_i2c.c [deleted file]
drivers/mmc/bfin_sdh.c
include/config_cmd_all.h
include/configs/HWW1U1A.h
include/configs/MBX.h
include/configs/MigoR.h
include/configs/adp-ag102.h [new file with mode: 0644]
include/configs/at91sam9m10g45ek.h
include/configs/debris.h
include/configs/digsy_mtc.h
include/configs/ep8260.h
include/configs/gplugd.h
include/configs/jadecpu.h
include/configs/kilauea.h
include/configs/lwmon5.h
include/configs/makalu.h
include/configs/ms7722se.h
include/configs/ms7750se.h
include/configs/omap3_logic.h
include/configs/quad100hd.h
include/configs/r2dplus.h
include/configs/sh7757lcr.h
include/configs/sh7785lcr.h
include/configs/spear-common.h
include/configs/u8500_href.h
include/configs/zeus.h
include/u-boot/md5.h
lib/md5.c
tools/patman/README

index 708ded79f6479565242ef5f298a7259347c39071..e2441d8d3129fa4cdd78b2f2673a4159dc30672a 100644 (file)
@@ -1191,6 +1191,7 @@ Macpaul Lin <macpaul@andestech.com>
 
        ADP-AG101       N1213 (AG101 SoC)
        ADP-AG101P      N1213 (AG101P XC5 FPGA)
+       ADP-AG102       N1213f (AG102 SoC with FPU)
 
 #########################################################################
 # OpenRISC Systems:                                                    #
index cdd4294334574428fd36ae51a83a7e6182880558..023ea23a38bdb3d187eaf2950999b989820bfa92 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@
 
 VERSION = 2012
 PATCHLEVEL = 04
-SUBLEVEL =
+SUBLEVEL = 01
 EXTRAVERSION =
 ifneq "$(SUBLEVEL)" ""
 U_BOOT_VERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
diff --git a/README b/README
index a0536a4b597870d936d9b27a6b9b2d1fb6a43f1d..79016e690ace8899488e54ee7a35e1715018e9a2 100644 (file)
--- a/README
+++ b/README
@@ -814,7 +814,7 @@ The following options need to be configured:
                CONFIG_CMD_TIME         * run command and report execution time
                CONFIG_CMD_USB          * USB support
                CONFIG_CMD_CDP          * Cisco Discover Protocol support
-               CONFIG_CMD_FSL          * Microblaze FSL support
+               CONFIG_CMD_MFSL         * Microblaze FSL support
 
 
                EXAMPLE: If you want all functions except of network
index 1295e88752473dab7217e14cf9c8ac38b1cc394b..8cf55c9a1c8b9956193aa25ed1d618cb3b5434fe 100644 (file)
@@ -54,7 +54,7 @@ void spl_nand_load_image(void)
                 * load parameter image
                 * load to temp position since nand_spl_load_image reads
                 * a whole block which is typically larger than
-                * CONFIG_CMD_SAVEBP_WRITE_SIZE therefore may overwrite
+                * CONFIG_CMD_SPL_WRITE_SIZE therefore may overwrite
                 * following sections like BSS
                 */
                nand_spl_load_image(CONFIG_CMD_SPL_NAND_OFS,
diff --git a/arch/arm/include/asm/arch-spear/spr_i2c.h b/arch/arm/include/asm/arch-spear/spr_i2c.h
deleted file mode 100644 (file)
index 7521ebc..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * (C) Copyright 2009
- * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#ifndef __SPR_I2C_H_
-#define __SPR_I2C_H_
-
-struct i2c_regs {
-       u32 ic_con;
-       u32 ic_tar;
-       u32 ic_sar;
-       u32 ic_hs_maddr;
-       u32 ic_cmd_data;
-       u32 ic_ss_scl_hcnt;
-       u32 ic_ss_scl_lcnt;
-       u32 ic_fs_scl_hcnt;
-       u32 ic_fs_scl_lcnt;
-       u32 ic_hs_scl_hcnt;
-       u32 ic_hs_scl_lcnt;
-       u32 ic_intr_stat;
-       u32 ic_intr_mask;
-       u32 ic_raw_intr_stat;
-       u32 ic_rx_tl;
-       u32 ic_tx_tl;
-       u32 ic_clr_intr;
-       u32 ic_clr_rx_under;
-       u32 ic_clr_rx_over;
-       u32 ic_clr_tx_over;
-       u32 ic_clr_rd_req;
-       u32 ic_clr_tx_abrt;
-       u32 ic_clr_rx_done;
-       u32 ic_clr_activity;
-       u32 ic_clr_stop_det;
-       u32 ic_clr_start_det;
-       u32 ic_clr_gen_call;
-       u32 ic_enable;
-       u32 ic_status;
-       u32 ic_txflr;
-       u32 ix_rxflr;
-       u32 reserved_1;
-       u32 ic_tx_abrt_source;
-};
-
-#define IC_CLK                 166
-#define NANO_TO_MICRO          1000
-
-/* High and low times in different speed modes (in ns) */
-#define MIN_SS_SCL_HIGHTIME    4000
-#define MIN_SS_SCL_LOWTIME     5000
-#define MIN_FS_SCL_HIGHTIME    800
-#define MIN_FS_SCL_LOWTIME     1700
-#define MIN_HS_SCL_HIGHTIME    60
-#define MIN_HS_SCL_LOWTIME     160
-
-/* Worst case timeout for 1 byte is kept as 2ms */
-#define I2C_BYTE_TO            (CONFIG_SYS_HZ/500)
-#define I2C_STOPDET_TO         (CONFIG_SYS_HZ/500)
-#define I2C_BYTE_TO_BB         (I2C_BYTE_TO * 16)
-
-/* i2c control register definitions */
-#define IC_CON_SD              0x0040
-#define IC_CON_RE              0x0020
-#define IC_CON_10BITADDRMASTER 0x0010
-#define IC_CON_10BITADDR_SLAVE 0x0008
-#define IC_CON_SPD_MSK         0x0006
-#define IC_CON_SPD_SS          0x0002
-#define IC_CON_SPD_FS          0x0004
-#define IC_CON_SPD_HS          0x0006
-#define IC_CON_MM              0x0001
-
-/* i2c target address register definitions */
-#define TAR_ADDR               0x0050
-
-/* i2c slave address register definitions */
-#define IC_SLAVE_ADDR          0x0002
-
-/* i2c data buffer and command register definitions */
-#define IC_CMD                 0x0100
-
-/* i2c interrupt status register definitions */
-#define IC_GEN_CALL            0x0800
-#define IC_START_DET           0x0400
-#define IC_STOP_DET            0x0200
-#define IC_ACTIVITY            0x0100
-#define IC_RX_DONE             0x0080
-#define IC_TX_ABRT             0x0040
-#define IC_RD_REQ              0x0020
-#define IC_TX_EMPTY            0x0010
-#define IC_TX_OVER             0x0008
-#define IC_RX_FULL             0x0004
-#define IC_RX_OVER             0x0002
-#define IC_RX_UNDER            0x0001
-
-/* fifo threshold register definitions */
-#define IC_TL0                 0x00
-#define IC_TL1                 0x01
-#define IC_TL2                 0x02
-#define IC_TL3                 0x03
-#define IC_TL4                 0x04
-#define IC_TL5                 0x05
-#define IC_TL6                 0x06
-#define IC_TL7                 0x07
-#define IC_RX_TL               IC_TL0
-#define IC_TX_TL               IC_TL0
-
-/* i2c enable register definitions */
-#define IC_ENABLE_0B           0x0001
-
-/* i2c status register  definitions */
-#define IC_STATUS_SA           0x0040
-#define IC_STATUS_MA           0x0020
-#define IC_STATUS_RFF          0x0010
-#define IC_STATUS_RFNE         0x0008
-#define IC_STATUS_TFE          0x0004
-#define IC_STATUS_TFNF         0x0002
-#define IC_STATUS_ACT          0x0001
-
-/* Speed Selection */
-#define IC_SPEED_MODE_STANDARD 1
-#define IC_SPEED_MODE_FAST     2
-#define IC_SPEED_MODE_MAX      3
-
-#define I2C_MAX_SPEED          3400000
-#define I2C_FAST_SPEED         400000
-#define I2C_STANDARD_SPEED     100000
-
-#endif /* __SPR_I2C_H_ */
index 1a8de4906da3f52b017d7cb520f7698832dac374..25cd8338657142f5c73d46addaa01a00b89e2aa5 100644 (file)
 #ifndef CONFIG_SYS_MALLOC_BASE
 # define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
 #endif
-#ifndef CONFIG_SYS_GBL_DATA_ADDR
-# define CONFIG_SYS_GBL_DATA_ADDR (CONFIG_SYS_MALLOC_BASE - GENERATED_GBL_DATA_SIZE)
-#endif
-#ifndef CONFIG_SYS_BD_INFO_ADDR
-# define CONFIG_SYS_BD_INFO_ADDR (CONFIG_SYS_GBL_DATA_ADDR - GENERATED_BD_INFO_SIZE)
-#endif
 #ifndef CONFIG_STACKBASE
-# define CONFIG_STACKBASE (CONFIG_SYS_BD_INFO_ADDR - 4)
+# define CONFIG_STACKBASE (CONFIG_SYS_MALLOC_BASE - 4)
 #endif
 #ifndef CONFIG_SYS_MEMTEST_START
 # define CONFIG_SYS_MEMTEST_START 0
index 67aa30f04c4c811cc5055de2f2c4958906668fd7..973ea2929a8640688bb9066dbcf02bd7c4ebdb12 100644 (file)
@@ -73,6 +73,6 @@ typedef struct global_data {
 #define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out)           */
 #define GD_FLG_ENV_READY       0x00080 /* Environment imported into hash table */
 
-#define DECLARE_GLOBAL_DATA_PTR     register gd_t * volatile gd asm ("P3")
+#define DECLARE_GLOBAL_DATA_PTR     register volatile gd_t *gd asm ("P3")
 
 #endif
index e3ee4cd353e364e0c8acbdda7889fb081c69c438..2d424a2da0b9029fe42576a354609beef6d14a3e 100644 (file)
@@ -181,6 +181,46 @@ void init_cplbtables(void)
        }
 }
 
+static int global_board_data_init(void)
+{
+#ifndef CONFIG_SYS_GBL_DATA_ADDR
+# define CONFIG_SYS_GBL_DATA_ADDR 0
+#endif
+#ifndef CONFIG_SYS_BD_INFO_ADDR
+# define CONFIG_SYS_BD_INFO_ADDR 0
+#endif
+
+       bd_t *bd;
+
+       if (CONFIG_SYS_GBL_DATA_ADDR) {
+               gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
+               memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
+       } else {
+               static gd_t _bfin_gd;
+               gd = &_bfin_gd;
+       }
+
+       if (CONFIG_SYS_BD_INFO_ADDR) {
+               bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR);
+               memset(bd, 0, GENERATED_BD_INFO_SIZE);
+       } else {
+               static bd_t _bfin_bd;
+               bd = &_bfin_bd;
+       }
+       gd->bd = bd;
+
+       bd->bi_r_version = version_string;
+       bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU);
+       bd->bi_board_name = BFIN_BOARD_NAME;
+       bd->bi_vco = get_vco();
+       bd->bi_cclk = get_cclk();
+       bd->bi_sclk = get_sclk();
+       bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
+       bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
+
+       return 0;
+}
+
 /*
  * All attempts to come up with a "common" initialization sequence
  * that works for all boards and architectures failed: some of the
@@ -201,7 +241,6 @@ extern int timer_init(void);
 
 void board_init_f(ulong bootflag)
 {
-       bd_t *bd;
        char buf[32];
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
@@ -234,21 +273,8 @@ void board_init_f(ulong bootflag)
                hang();
 #endif
        serial_early_puts("Init global data\n");
-       gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
-       memset((void *)gd, 0, GENERATED_GBL_DATA_SIZE);
-
-       bd = (bd_t *) (CONFIG_SYS_BD_INFO_ADDR);
-       gd->bd = bd;
-       memset((void *)bd, 0, GENERATED_BD_INFO_SIZE);
 
-       bd->bi_r_version = version_string;
-       bd->bi_cpu = MK_STR(CONFIG_BFIN_CPU);
-       bd->bi_board_name = BFIN_BOARD_NAME;
-       bd->bi_vco = get_vco();
-       bd->bi_cclk = get_cclk();
-       bd->bi_sclk = get_sclk();
-       bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       bd->bi_memsize = CONFIG_SYS_MAX_RAM_SIZE;
+       global_board_data_init();
 
        /* Initialize */
        serial_early_puts("IRQ init\n");
@@ -276,7 +302,7 @@ void board_init_f(ulong bootflag)
 
        if (CONFIG_MEM_SIZE) {
                printf("RAM:   ");
-               print_size(bd->bi_memsize, "\n");
+               print_size(gd->bd->bi_memsize, "\n");
        }
 
 #if defined(CONFIG_POST)
diff --git a/arch/nds32/cpu/n1213/ag102/Makefile b/arch/nds32/cpu/n1213/ag102/Makefile
new file mode 100644 (file)
index 0000000..8716c4e
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <prafulla@marvell.com>
+#
+# Copyright (C) 2011 Andes Technology Corporation
+# Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
+# Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(SOC).o
+
+COBJS-y        := cpu.o timer.o
+
+ifndef CONFIG_SKIP_LOWLEVEL_INIT
+SOBJS  := lowlevel_init.o
+endif
+
+ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG
+SOBJS  += watchdog.o
+endif
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:   $(obj).depend $(LIB)
+
+$(LIB):        $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/arch/nds32/cpu/n1213/ag102/asm-offsets.c b/arch/nds32/cpu/n1213/ag102/asm-offsets.c
new file mode 100644 (file)
index 0000000..4769a95
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Adapted from Linux v2.6.36 kernel: arch/powerpc/kernel/asm-offsets.c
+ *
+ * Generate definitions needed by assembly language modules.
+ * This code generates raw asm output which is post-processed to extract
+ * and format the required data.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <common.h>
+
+#include <linux/kbuild.h>
+
+int main(void)
+{
+#ifdef CONFIG_FTSMC020
+       OFFSET(FTSMC020_BANK0_CR,       ftsmc020, bank[0].cr);
+       OFFSET(FTSMC020_BANK0_TPR,      ftsmc020, bank[0].tpr);
+#endif
+       BLANK();
+#ifdef CONFIG_FTAHBC020S
+       OFFSET(FTAHBC020S_SLAVE_BSR_6,  ftahbc02s, s_bsr[6]);
+       OFFSET(FTAHBC020S_CR,           ftahbc02s, cr);
+#endif
+       BLANK();
+#ifdef CONFIG_ANDES_PCU
+       OFFSET(ANDES_PCU_PCS4,          andes_pcu, pcs4.parm);  /* 0x104 */
+#endif
+       BLANK();
+#ifdef CONFIG_DWCDDR21MCTL
+       OFFSET(DWCDDR21MCTL_CCR,        dwcddr21mctl, ccr);     /* 0x04 */
+       OFFSET(DWCDDR21MCTL_DCR,        dwcddr21mctl, dcr);     /* 0x04 */
+       OFFSET(DWCDDR21MCTL_IOCR,       dwcddr21mctl, iocr);    /* 0x08 */
+       OFFSET(DWCDDR21MCTL_CSR,        dwcddr21mctl, csr);     /* 0x0c */
+       OFFSET(DWCDDR21MCTL_DRR,        dwcddr21mctl, drr);     /* 0x10 */
+       OFFSET(DWCDDR21MCTL_DLLCR0,     dwcddr21mctl, dllcr[0]); /* 0x24 */
+       OFFSET(DWCDDR21MCTL_DLLCR1,     dwcddr21mctl, dllcr[1]); /* 0x28 */
+       OFFSET(DWCDDR21MCTL_DLLCR2,     dwcddr21mctl, dllcr[2]); /* 0x2c */
+       OFFSET(DWCDDR21MCTL_DLLCR3,     dwcddr21mctl, dllcr[3]); /* 0x30 */
+       OFFSET(DWCDDR21MCTL_DLLCR4,     dwcddr21mctl, dllcr[4]); /* 0x34 */
+       OFFSET(DWCDDR21MCTL_DLLCR5,     dwcddr21mctl, dllcr[5]); /* 0x38 */
+       OFFSET(DWCDDR21MCTL_DLLCR6,     dwcddr21mctl, dllcr[6]); /* 0x3c */
+       OFFSET(DWCDDR21MCTL_DLLCR7,     dwcddr21mctl, dllcr[7]); /* 0x40 */
+       OFFSET(DWCDDR21MCTL_DLLCR8,     dwcddr21mctl, dllcr[8]); /* 0x44 */
+       OFFSET(DWCDDR21MCTL_DLLCR9,     dwcddr21mctl, dllcr[9]); /* 0x48 */
+       OFFSET(DWCDDR21MCTL_RSLR0,      dwcddr21mctl, rslr[0]); /* 0x4c */
+       OFFSET(DWCDDR21MCTL_RDGR0,      dwcddr21mctl, rdgr[0]); /* 0x5c */
+       OFFSET(DWCDDR21MCTL_DTAR,       dwcddr21mctl, dtar);    /* 0xa4 */
+       OFFSET(DWCDDR21MCTL_MR,         dwcddr21mctl, mr);      /* 0x1f0 */
+#endif
+       return 0;
+}
diff --git a/arch/nds32/cpu/n1213/ag102/cpu.c b/arch/nds32/cpu/n1213/ag102/cpu.c
new file mode 100644 (file)
index 0000000..ed88b52
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger@sysgo.de>
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
+ *
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
+ * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* CPU specific code */
+#include <common.h>
+#include <command.h>
+#include <watchdog.h>
+#include <asm/cache.h>
+
+#include <faraday/ftwdt010_wdt.h>
+
+/*
+ * cleanup_before_linux() is called just before we call linux
+ * it prepares the processor for linux
+ *
+ * we disable interrupt and caches.
+ */
+int cleanup_before_linux(void)
+{
+       disable_interrupts();
+
+#ifdef CONFIG_MMU
+       /* turn off I/D-cache */
+       icache_disable();
+       dcache_disable();
+
+       /* flush I/D-cache */
+       invalidate_icac();
+       invalidate_dcac();
+#endif
+
+       return 0;
+}
+
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+       disable_interrupts();
+
+       /*
+        * reset to the base addr of andesboot.
+        * currently no ROM loader at addr 0.
+        * do not use reset_cpu(0);
+        */
+#ifdef CONFIG_FTWDT010_WATCHDOG
+       /*
+        * workaround: if we use CONFIG_HW_WATCHDOG with ftwdt010, will lead
+        * automatic hardware reset when booting Linux.
+        * Please do not use CONFIG_HW_WATCHDOG and WATCHDOG_RESET() here.
+        */
+       ftwdt010_wdt_reset();
+#endif /* CONFIG_FTWDT010_WATCHDOG */
+       hang();
+
+       /*NOTREACHED*/
+}
+
+static inline unsigned long CACHE_LINE_SIZE(enum cache_t cache)
+{
+       if (cache == ICACHE)
+               return 8 << (((GET_ICM_CFG() & ICM_CFG_MSK_ISZ) \
+                                       >> ICM_CFG_OFF_ISZ) - 1);
+       else
+               return 8 << (((GET_DCM_CFG() & DCM_CFG_MSK_DSZ) \
+                                       >> DCM_CFG_OFF_DSZ) - 1);
+}
+
+void dcache_flush_range(unsigned long start, unsigned long end)
+{
+       unsigned long line_size;
+
+       line_size = CACHE_LINE_SIZE(DCACHE);
+
+       while (end > start) {
+               __asm__ volatile ("\n\tcctl %0, L1D_VA_WB" : : "r"(start));
+               __asm__ volatile ("\n\tcctl %0, L1D_VA_INVAL" : : "r"(start));
+               start += line_size;
+       }
+}
+
+void icache_inval_range(unsigned long start, unsigned long end)
+{
+       unsigned long line_size;
+
+       line_size = CACHE_LINE_SIZE(ICACHE);
+       while (end > start) {
+               __asm__ volatile ("\n\tcctl %0, L1I_VA_INVAL" : : "r"(start));
+               start += line_size;
+       }
+}
+
+void flush_cache(unsigned long addr, unsigned long size)
+{
+       dcache_flush_range(addr, addr + size);
+       icache_inval_range(addr, addr + size);
+}
+
+void icache_enable(void)
+{
+       __asm__ __volatile__ (
+               "mfsr   $p0, $mr8\n\t"
+               "ori    $p0, $p0, 0x01\n\t"
+               "mtsr   $p0, $mr8\n\t"
+               "isb\n\t"
+       );
+}
+
+void icache_disable(void)
+{
+       __asm__ __volatile__ (
+               "mfsr   $p0, $mr8\n\t"
+               "li     $p1, ~0x01\n\t"
+               "and    $p0, $p0, $p1\n\t"
+               "mtsr   $p0, $mr8\n\t"
+               "isb\n\t"
+       );
+}
+
+int icache_status(void)
+{
+       int ret;
+
+        __asm__ __volatile__ (
+               "mfsr   $p0, $mr8\n\t"
+               "andi   %0,  $p0, 0x01\n\t"
+               : "=r" (ret)
+               :
+               : "memory"
+       );
+
+        return ret;
+}
+
+void dcache_enable(void)
+{
+        __asm__ __volatile__ (
+               "mfsr   $p0, $mr8\n\t"
+               "ori    $p0, $p0, 0x02\n\t"
+               "mtsr   $p0, $mr8\n\t"
+               "isb\n\t"
+       );
+}
+
+void dcache_disable(void)
+{
+        __asm__ __volatile__ (
+               "mfsr   $p0, $mr8\n\t"
+               "li     $p1, ~0x02\n\t"
+               "and    $p0, $p0, $p1\n\t"
+               "mtsr   $p0, $mr8\n\t"
+               "isb\n\t"
+       );
+}
+
+int dcache_status(void)
+{
+       int ret;
+
+       __asm__ __volatile__ (
+               "mfsr   $p0, $mr8\n\t"
+               "andi   %0, $p0, 0x02\n\t"
+               : "=r" (ret)
+               :
+               : "memory"
+        );
+
+        return ret;
+}
diff --git a/arch/nds32/cpu/n1213/ag102/lowlevel_init.S b/arch/nds32/cpu/n1213/ag102/lowlevel_init.S
new file mode 100644 (file)
index 0000000..d842afa
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+.text
+
+#include <common.h>
+#include <config.h>
+
+#include <asm/macro.h>
+#include <generated/asm-offsets.h>
+
+/*
+ * parameters for Synopsys DWC DDR2/DDR1 Memory Controller
+ */
+#define DDR2C_BASE_A           (CONFIG_DWCDDR21MCTL_BASE)
+#define DDR2C_CCR_A            (DDR2C_BASE_A + DWCDDR21MCTL_CCR)
+#define DDR2C_DCR_A            (DDR2C_BASE_A + DWCDDR21MCTL_DCR)
+#define DDR2C_IOCR_A           (DDR2C_BASE_A + DWCDDR21MCTL_IOCR)
+#define DDR2C_CSR_A            (DDR2C_BASE_A + DWCDDR21MCTL_CSR)
+#define DDR2C_DRR_A            (DDR2C_BASE_A + DWCDDR21MCTL_DRR)
+#define DDR2C_DLLCR0_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR0)
+#define DDR2C_DLLCR1_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR1)
+#define DDR2C_DLLCR2_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR2)
+#define DDR2C_DLLCR3_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR3)
+#define DDR2C_DLLCR4_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR4)
+#define DDR2C_DLLCR5_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR5)
+#define DDR2C_DLLCR6_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR6)
+#define DDR2C_DLLCR7_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR7)
+#define DDR2C_DLLCR8_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR8)
+#define DDR2C_DLLCR9_A         (DDR2C_BASE_A + DWCDDR21MCTL_DLLCR9)
+#define DDR2C_RSLR0_A          (DDR2C_BASE_A + DWCDDR21MCTL_RSLR0)
+#define DDR2C_RDGR0_A          (DDR2C_BASE_A + DWCDDR21MCTL_RDGR0)
+#define DDR2C_DTAR_A           (DDR2C_BASE_A + DWCDDR21MCTL_DTAR)
+#define DDR2C_MR_A             (DDR2C_BASE_A + DWCDDR21MCTL_MR)
+
+#define DDR2C_CCR_D            CONFIG_SYS_DWCDDR21MCTL_CCR
+#define DDR2C_CCR_D2           CONFIG_SYS_DWCDDR21MCTL_CCR2
+#define DDR2C_DCR_D            CONFIG_SYS_DWCDDR21MCTL_DCR
+#define DDR2C_IOCR_D           CONFIG_SYS_DWCDDR21MCTL_IOCR
+#define DDR2C_CSR_D            CONFIG_SYS_DWCDDR21MCTL_CSR
+#define DDR2C_DRR_D            CONFIG_SYS_DWCDDR21MCTL_DRR
+#define DDR2C_RSLR0_D          CONFIG_SYS_DWCDDR21MCTL_RSLR0
+#define DDR2C_RDGR0_D          CONFIG_SYS_DWCDDR21MCTL_RDGR0
+#define DDR2C_DTAR_D           CONFIG_SYS_DWCDDR21MCTL_DTAR
+#define DDR2C_MR_D             CONFIG_SYS_DWCDDR21MCTL_MR
+
+#define DDR2C_DLLCR0_D CONFIG_SYS_DWCDDR21MCTL_DLLCR0  /* 0-9 are same */
+
+/*
+ * parameters for the ahbc controller
+ */
+#define AHBC_CR_A              (CONFIG_FTAHBC020S_BASE + FTAHBC020S_CR)
+#define AHBC_BSR6_A    (CONFIG_FTAHBC020S_BASE + FTAHBC020S_SLAVE_BSR_6)
+
+#define AHBC_BSR6_D            CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6
+
+/*
+ * parameters for the ANDES PCU controller
+ */
+#define PCU_PCS4_A             (CONFIG_ANDES_PCU_BASE + ANDES_PCU_PCS4)
+#define PCU_PCS4_D             CONFIG_SYS_ANDES_CPU_PCS4
+
+/*
+ * numeric 7 segment display
+ */
+.macro led, num
+       write32 CONFIG_DEBUG_LED, \num
+.endm
+
+/*
+ * Waiting for SDRAM to set up
+ */
+/*
+.macro wait_sdram
+       li      $r0, DDR2C_CSR_A
+1:
+       lwi     $r1, [$r0+FTSDMC021_CR2]
+       bnez    $r1, 1b
+.endm
+*/
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+.globl lowlevel_init
+lowlevel_init:
+       move    $r10, $lp
+
+       /* U200 */
+!      led     0x00
+!      jal     scale_to_500mhz
+
+       led     0x10
+       jal     mem_init
+
+       led     0x20
+       jal     remap
+
+       led     0x30
+       ret     $r10
+
+scale_to_500mhz:
+       move    $r11, $lp
+
+       /*
+        * scale to 500Mhz
+        */
+       led     0x01
+       write32 PCU_PCS4_A, 0x1102000f                  ! save data to PCS4
+
+       move    $lp, $r11
+       ret
+
+mem_init:
+       move    $r11, $lp
+
+       /*
+        * config AHB Controller
+        */
+       led     0x12
+       write32 AHBC_BSR6_A, AHBC_BSR6_D
+
+       /*
+        * config Synopsys DWC DDR2/DDR1 Memory Controller
+        */
+ddr2c_init:
+set_dcr:
+       led     0x14
+       write32 DDR2C_DCR_A, DDR2C_DCR_D                        ! 0x000020d4
+
+auto_sizing:
+       /*
+        * ebios: $r10->$r7, $r11->$r8, $r12->$r9, $r13->$r12, $r14->$r13
+        */
+set_iocr:
+       led     0x19
+       write32 DDR2C_IOCR_A, DDR2C_IOCR_D
+set_drr:
+       led     0x16
+       write32 DDR2C_DRR_A, DDR2C_DRR_D                        ! 0x00034812
+set_dllcr:
+       led     0x18
+       write32 DDR2C_DLLCR0_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR1_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR2_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR3_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR4_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR5_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR6_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR7_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR8_A, DDR2C_DLLCR0_D
+       write32 DDR2C_DLLCR9_A, DDR2C_DLLCR0_D
+set_rslr0:
+       write32 DDR2C_RSLR0_A, DDR2C_RSLR0_D                    ! 0x00000040
+set_rdgr0:
+       write32 DDR2C_RDGR0_A, DDR2C_RDGR0_D                    ! 0x000055cf
+set_dtar:
+       led     0x15
+       write32 DDR2C_DTAR_A, DDR2C_DTAR_D                      ! 0x00100000
+set_mode:
+       led     0x17
+       write32 DDR2C_MR_A, DDR2C_MR_D                          ! 0x00000852
+set_ccr:
+       write32 DDR2C_CCR_A, DDR2C_CCR_D
+
+#ifdef TRIGGER_INIT:
+trigger_init:
+       write32 DDR2C_CCR_A, DDR2C_CCR_D                        ! 0x80020000
+
+       /* Wait for ddr init state to be set */
+       msync   ALL
+       isb
+
+       /* Wait until the config initialization is finish */
+1:
+       la      $r4, DDR2C_CSR_A
+       lwi     $r5, [$r4]
+       srli    $r5, $r5, 23
+       bnez    $r5, 1b
+#endif
+
+data_training:
+!      write32 DDR2C_CCR_A, DDR2C_CCR_D2                       ! 0x40020004
+
+       /* Wait for ddr init state to be set */
+       msync   ALL
+       isb
+
+       /* wait until the ddr data trainning is complete */
+1:
+       la      $r4, DDR2C_CSR_A
+       lwi     $r5, [$r4]
+       srli    $r6, $r5, 23
+       bnez    $r6, 1b
+
+       lwi     $r1, [$r4]
+       srli    $r6, $r5, 20
+       li      $r5, 0x00ffffff
+       swi     $r1, [$r4]
+       bnez    $r6, ddr2c_init
+
+       led     0x1a
+       move    $lp, $r11
+       ret
+
+remap:
+       move    $r11, $lp
+#ifdef __NDS32_N1213_43U1H__   /* NDS32 V0 ISA - AG101 Only */
+       bal     2f
+relo_base:
+       move    $r0, $lp
+#else
+relo_base:
+       mfusr   $r0, $pc
+#endif /* __NDS32_N1213_43U1H__ */
+
+       /*
+        * Remapping
+        */
+#ifdef CONFIG_MEM_REMAP
+       /*
+        * Copy ROM code to SDRAM base for memory remap layout.
+        * This is not the real relocation, the real relocation is the function
+        * relocate_code() is start.S which supports the systems is memory
+        * remapped or not.
+        */
+       /*
+        * Doing memory remap is essential for preparing some non-OS or RTOS
+        * applications.
+        *
+        * This is also a must on ADP-AG101 board.
+        * The reason is because the ROM/FLASH circuit on PCB board.
+        * AG101-A0 board has 2 jumpers MA17 and SW5 to configure which
+        * ROM/FLASH is used to boot.
+        *
+        * When SW5 = "0101", MA17 = LO, the ROM is connected to BANK0,
+        * and the FLASH is connected to BANK1.
+        * When SW5 = "1010", MA17 = HI, the ROM is disabled (still at BANK0),
+        * and the FLASH is connected to BANK0.
+        * It will occur problem when doing flash probing if the flash is at
+        * BANK0 (0x00000000) while memory remapping was skipped.
+        *
+        * Other board like ADP-AG101P may not enable this since there is only
+        * a FLASH connected to bank0.
+        */
+       led     0x21
+       li      $r4, PHYS_SDRAM_0_AT_INIT               /* 0x10000000 */
+       li      $r5, 0x0
+       la      $r1, relo_base                          /* get $pc or $lp */
+       sub     $r2, $r0, $r1
+       sethi   $r6, hi20(_end)
+       ori     $r6, $r6, lo12(_end)
+       add     $r6, $r6, $r2
+1:
+       lwi.p   $r7, [$r5], #4
+       swi.p   $r7, [$r4], #4
+       blt     $r5, $r6, 1b
+
+       /* set remap bit */
+       /*
+        * MEM remap bit is operational
+        * - use it to map writeable memory at 0x00000000, in place of flash
+        * - before remap: flash/rom 0x00000000, sdram: 0x10000000-0x4fffffff
+        * - after  remap: flash/rom 0x80000000, sdram: 0x00000000
+        */
+       led     0x2c
+       setbf15 AHBC_CR_A, FTAHBC020S_CR_REMAP          ! 0x1
+
+#endif /* #ifdef CONFIG_MEM_REMAP */
+       move    $lp, $r11
+2:
+       ret
+
+.globl show_led
+show_led:
+    li      $r8, (CONFIG_DEBUG_LED)
+    swi     $r7, [$r8]
+    ret
+#endif /* #ifndef CONFIG_SKIP_LOWLEVEL_INIT */
diff --git a/arch/nds32/cpu/n1213/ag102/timer.c b/arch/nds32/cpu/n1213/ag102/timer.c
new file mode 100644 (file)
index 0000000..caa36b8
--- /dev/null
@@ -0,0 +1,205 @@
+/*
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang <ratbert@faraday-tech.com>
+ *
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
+ * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <faraday/fttmr010.h>
+
+static ulong timestamp;
+static ulong lastdec;
+
+int timer_init(void)
+{
+       struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+       unsigned int cr;
+
+       debug("%s()\n", __func__);
+
+       /* disable timers */
+       writel(0, &tmr->cr);
+
+#ifdef CONFIG_FTTMR010_EXT_CLK
+       /* use 32768Hz oscillator for RTC, WDT, TIMER */
+       ftpmu010_32768osc_enable();
+#endif
+
+       /* setup timer */
+       writel(TIMER_LOAD_VAL, &tmr->timer3_load);
+       writel(TIMER_LOAD_VAL, &tmr->timer3_counter);
+       writel(0, &tmr->timer3_match1);
+       writel(0, &tmr->timer3_match2);
+
+       /* we don't want timer to issue interrupts */
+       writel(FTTMR010_TM3_MATCH1 |
+              FTTMR010_TM3_MATCH2 |
+              FTTMR010_TM3_OVERFLOW,
+              &tmr->interrupt_mask);
+
+       cr = readl(&tmr->cr);
+#ifdef CONFIG_FTTMR010_EXT_CLK
+       cr |= FTTMR010_TM3_CLOCK;       /* use external clock */
+#endif
+       cr |= FTTMR010_TM3_ENABLE;
+       writel(cr, &tmr->cr);
+
+       /* init the timestamp and lastdec value */
+       reset_timer_masked();
+
+       return 0;
+}
+
+/*
+ * timer without interrupts
+ */
+
+/*
+ * reset time
+ */
+void reset_timer_masked(void)
+{
+       struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+
+       /* capure current decrementer value time */
+#ifdef CONFIG_FTTMR010_EXT_CLK
+       lastdec = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
+#else
+       lastdec = readl(&tmr->timer3_counter) / (CONFIG_SYS_CLK_FREQ / 2);
+#endif
+       timestamp = 0;          /* start "advancing" time stamp from 0 */
+
+       debug("%s(): lastdec = %lx\n", __func__, lastdec);
+}
+
+void reset_timer(void)
+{
+       debug("%s()\n", __func__);
+       reset_timer_masked();
+}
+
+/*
+ * return timer ticks
+ */
+ulong get_timer_masked(void)
+{
+       struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+
+       /* current tick value */
+#ifdef CONFIG_FTTMR010_EXT_CLK
+       ulong now = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
+#else
+       ulong now = readl(&tmr->timer3_counter) / \
+                       (CONFIG_SYS_CLK_FREQ / 2 / 1024);
+#endif
+
+       debug("%s(): now = %lx, lastdec = %lx\n", __func__, now, lastdec);
+
+       if (lastdec >= now) {
+               /*
+                * normal mode (non roll)
+                * move stamp fordward with absoulte diff ticks
+                */
+               timestamp += lastdec - now;
+       } else {
+               /*
+                * we have overflow of the count down timer
+                *
+                * nts = ts + ld + (TLV - now)
+                * ts=old stamp, ld=time that passed before passing through -1
+                * (TLV-now) amount of time after passing though -1
+                * nts = new "advancing time stamp"...it could also roll and
+                * cause problems.
+                */
+               timestamp += lastdec + TIMER_LOAD_VAL - now;
+       }
+
+       lastdec = now;
+
+       debug("%s() returns %lx\n", __func__, timestamp);
+
+       return timestamp;
+}
+
+/*
+ * return difference between timer ticks and base
+ */
+ulong get_timer(ulong base)
+{
+       debug("%s(%lx)\n", __func__, base);
+       return get_timer_masked() - base;
+}
+
+void set_timer(ulong t)
+{
+       debug("%s(%lx)\n", __func__, t);
+       timestamp = t;
+}
+
+/* delay x useconds AND preserve advance timestamp value */
+void __udelay(unsigned long usec)
+{
+       struct fttmr010 *tmr = (struct fttmr010 *)CONFIG_FTTMR010_BASE;
+
+#ifdef CONFIG_FTTMR010_EXT_CLK
+       long tmo = usec * (TIMER_CLOCK / 1000) / 1000;
+#else
+       long tmo = usec * ((CONFIG_SYS_CLK_FREQ / 2) / 1000) / 1000;
+#endif
+       unsigned long now, last = readl(&tmr->timer3_counter);
+
+       debug("%s(%lu)\n", __func__, usec);
+       while (tmo > 0) {
+               now = readl(&tmr->timer3_counter);
+               if (now > last) /* count down timer overflow */
+                       tmo -= TIMER_LOAD_VAL + last - now;
+               else
+                       tmo -= 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)
+{
+       debug("%s()\n", __func__);
+       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)
+{
+       debug("%s()\n", __func__);
+#ifdef CONFIG_FTTMR010_EXT_CLK
+       return CONFIG_SYS_HZ;
+#else
+       return CONFIG_SYS_CLK_FREQ;
+#endif
+}
diff --git a/arch/nds32/cpu/n1213/ag102/watchdog.S b/arch/nds32/cpu/n1213/ag102/watchdog.S
new file mode 100644 (file)
index 0000000..56cecda
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <asm/arch-ag102/ag102.h>
+#include <linux/linkage.h>
+
+.text
+
+#ifndef CONFIG_SKIP_TRUNOFF_WATCHDOG
+ENTRY(turnoff_watchdog)
+
+#define WD_CR          0xC
+#define WD_ENABLE      0x1
+
+       ! Turn off the watchdog, according to Faraday FTWDT010 spec
+       li      $p0, (CONFIG_FTWDT010_BASE+WD_CR)       ! Get the addr of WD CR
+       lwi     $p1, [$p0]                              ! Get the config of WD
+       andi    $p1, $p1, 0x1f                          ! Wipe out useless bits
+       li      $r0, ~WD_ENABLE
+       and     $p1, $p1, $r0                           ! Set WD disable
+       sw      $p1, [$p0]                              ! Write back to WD CR
+
+       ! Disable Interrupts by clear GIE in $PSW reg
+       setgie.d
+
+       ret
+
+ENDPROC(turnoff_watchdog)
+#endif
diff --git a/arch/nds32/include/asm/arch-ag102/ag102.h b/arch/nds32/include/asm/arch-ag102/ag102.h
new file mode 100644 (file)
index 0000000..a12a8c5
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __AG102_H
+#define __AG102_H
+
+/*
+ * Hardware register bases
+ */
+
+/* PCI Controller */
+#define CONFIG_FTPCI100_BASE           0x90000000
+/* LPC Controller */
+#define CONFIG_LPC_IO_BASE             0x90100000
+/* LPC Controller */
+#define CONFIG_LPC_BASE                        0x90200000
+
+/* NDS32 Data Local Memory 01 */
+#define CONFIG_NDS_DLM1_BASE           0x90300000
+/* NDS32 Data Local Memory 02 */
+#define CONFIG_NDS_DLM2_BASE           0x90400000
+
+/* Synopsys DWC DDR2/1 Controller */
+#define CONFIG_DWCDDR21MCTL_BASE       0x90500000
+/* DMA Controller */
+#define CONFIG_FTDMAC020_BASE          0x90600000
+/* FTIDE020_S IDE (ATA) Controller */
+#define CONFIG_FTIDE020S_BASE          0x90700000
+/* USB OTG Controller */
+#define CONFIG_FZOTG266HD0A_BASE       0x90800000
+/* Andes L2 Cache Controller */
+#define CONFIG_NCEL2C100_BASE          0x90900000
+/* XGI XG22 GPU */
+#define CONFIG_XGI_XG22_BASE           0x90A00000
+/* GMAC Ethernet Controller */
+#define CONFIG_FTGMAC100_BASE          0x90B00000
+/* AHB Controller */
+#define CONFIG_FTAHBC020S_BASE         0x90C00000
+/* AHB-to-APB Bridge Controller */
+#define CONFIG_FTAPBBRG020S_01_BASE    0x90D00000
+/* External AHB2AHB Controller */
+#define CONFIG_EXT_AHB2AHB_BASE                0x90E00000
+/* Andes Multi-core Interrupt Controller */
+#define CONFIG_NCEMIC100_BASE          0x90F00000
+
+/*
+ * APB Device definitions
+ */
+/* Compat Flash Controller */
+#define CONFIG_FTCFC010_BASE           0x94000000
+/* APB - SSP (SPI) (without AC97) Controller */
+#define CONFIG_FTSSP010_01_BASE                0x94100000
+/* UART1 - APB STUART Controller (UART0 in Linux) */
+#define CONFIG_FTUART010_01_BASE       0x94200000
+/* FTSDC010 SD Controller */
+#define CONFIG_FTSDC010_BASE           0x94400000
+/* APB - SSP with HDA/AC97 Controller */
+#define CONFIG_FTSSP010_02_BASE                0x94500000
+/* UART2 - APB STUART Controller (UART1 in Linux) */
+#define CONFIG_FTUART010_02_BASE       0x94600000
+/* PCU Controller */
+#define CONFIG_ANDES_PCU_BASE          0x94800000
+/* FTTMR010 Timer */
+#define CONFIG_FTTMR010_BASE           0x94900000
+/* Watch Dog Controller */
+#define CONFIG_FTWDT010_BASE           0x94A00000
+/* FTRTC010 Real Time Clock */
+#define CONFIG_FTRTC010_BASE           0x98B00000
+/* GPIO Controller */
+#define CONFIG_FTGPIO010_BASE          0x94C00000
+/* I2C Controller */
+#define CONFIG_FTIIC010_BASE           0x94E00000
+/* PWM - Pulse Width Modulator Controller */
+#define CONFIG_FTPWM010_BASE           0x94F00000
+
+/* Debug LED */
+#define CONFIG_DEBUG_LED               0x902FFFFC
+/* Power Management Unit */
+#define CONFIG_FTPMU010_BASE           0x98100000
+
+#endif /* __AG102_H */
index 7b52b989bc1f61ffb0ebc062c063f8e80a31e7bb..259e4e7ad942d805cb3ad3e1721ab9d25453f595 100644 (file)
@@ -40,4 +40,18 @@ extern unsigned int __machine_arch_type;
 # define machine_is_adpag101p()        (1)
 #endif
 
+#define MACH_TYPE_ADPAG102             2
+
+#ifdef CONFIG_ARCH_ADPAG102
+# ifdef machine_arch_type
+#  undef machine_arch_type
+#  define machine_arch_type    __machine_arch_type
+# else
+#  define machine_arch_type    MACH_TYPE_ADPAG102
+# endif
+# define machine_is_adpag102() (machine_arch_type == MACH_TYPE_ADPAG102)
+#else
+# define machine_is_adpag102() (2)
+#endif
+
 #endif /* __ASM_NDS32_MACH_TYPE_H */
diff --git a/board/AndesTech/adp-ag102/Makefile b/board/AndesTech/adp-ag102/Makefile
new file mode 100644 (file)
index 0000000..1cbf2d4
--- /dev/null
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2011 Andes Technology Corporation
+# Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB    = $(obj)lib$(BOARD).o
+
+COBJS  := adp-ag102.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS) $(SOBJS))
+
+$(LIB):        $(OBJS)
+       $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/AndesTech/adp-ag102/adp-ag102.c b/board/AndesTech/adp-ag102/adp-ag102.c
new file mode 100644 (file)
index 0000000..5a25632
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Shawn Lin, Andes Technology Corporation <nobuhiro@andestech.com>
+ * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <common.h>
+#include <netdev.h>
+#include <asm/io.h>
+
+#include <faraday/ftsdc010.h>
+#ifdef CONFIG_FTSMC020
+#include <faraday/ftsmc020.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Miscellaneous platform dependent initializations
+ */
+
+int board_init(void)
+{
+       /*
+        * refer to BOOT_PARAMETER_PA_BASE within
+        * "linux/arch/nds32/include/asm/misc_spec.h"
+        */
+       gd->bd->bi_arch_number = MACH_TYPE_ADPAG102;
+       gd->bd->bi_boot_params = PHYS_SDRAM_0 + 0x400;
+
+#if !defined(CONFIG_SYS_NO_FLASH)
+       ftsmc020_init();        /* initialize Flash */
+#endif /* CONFIG_SYS_NO_FLASH */
+       return 0;
+}
+
+int dram_init(void)
+{
+       unsigned long sdram_base = PHYS_SDRAM_0;
+       unsigned long expected_size = PHYS_SDRAM_0_SIZE;
+       unsigned long actual_size;
+
+       actual_size = get_ram_size((void *)sdram_base, expected_size);
+
+       gd->ram_size = actual_size;
+
+       if (expected_size != actual_size) {
+               printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
+                               actual_size >> 20, expected_size >> 20);
+       }
+
+       return 0;
+}
+
+int board_eth_init(bd_t *bd)
+{
+       return ftgmac100_initialize(bd);
+}
+
+#if !defined(CONFIG_SYS_NO_FLASH)
+ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
+{
+       if (banknum == 0) {     /* non-CFI boot flash */
+               info->portwidth = FLASH_CFI_8BIT;
+               info->chipwidth = FLASH_CFI_BY8;
+               info->interface = FLASH_CFI_X8;
+               return 1;
+       } else {
+               return 0;
+       }
+}
+#endif /* CONFIG_SYS_NO_FLASH */
+
+#if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
+void pci_init_board(void)
+{
+       /* should be pci_ftpci100_init() */
+       extern void pci_ftpci_init();
+
+       pci_ftpci_init();
+}
+#endif
+
+#ifdef CONFIG_GENERIC_MMC
+int board_mmc_init(bd_t *bis)
+{
+       ftsdc010_mmc_init(0);
+       return 0;
+}
+#endif
index 7194e08960673dafdfc515d5570280f6f0ae8b95..15339f7a65804c2e74fa793d0786c182888aa40c 100644 (file)
@@ -370,6 +370,7 @@ incaip_150MHz                mips        mips32      incaip              -
 qi_lb60                      mips        xburst      qi_lb60             qi
 adp-ag101                    nds32       n1213       adp-ag101           AndesTech      ag101
 adp-ag101p                   nds32       n1213       adp-ag101p          AndesTech      ag101
+adp-ag102                    nds32       n1213       adp-ag102           AndesTech      ag102
 nios2-generic                nios2       nios2       nios2-generic       altera
 PCI5441                      nios2       nios2       pci5441             psyent
 PK1C20                       nios2       nios2       pk1c20              psyent
index bae630dfb68ff1b3847a11d9b2f028751f105640..0fd3a6c414aa9c35f13a8ec1a9bd60d4614634df 100644 (file)
@@ -191,7 +191,7 @@ static int arg_off_size(int argc, char *const argv[], int *idx,
                        loff_t *off, loff_t *size)
 {
        int ret;
-       loff_t maxsize;
+       loff_t maxsize = 0;
 
        if (argc == 0) {
                *off = 0;
diff --git a/doc/README.ag102 b/doc/README.ag102
new file mode 100644 (file)
index 0000000..7d142a7
--- /dev/null
@@ -0,0 +1,36 @@
+Andes Technology SoC AG102
+==========================
+
+AG102 is the second SoC produced by Andes Technology using N1213 CPU core
+with FPU and DDR contoller support.
+AG102 has integrated both AHB and APB bus and many periphals for application
+and product development.
+
+ADP-AG102
+=========
+
+ADP-AG102 is the SoC with AG102 hardcore CPU.
+
+Configurations
+==============
+
+CONFIG_MEM_REMAP:
+       Doing memory remap is essential for preparing some non-OS or RTOS
+       applications.
+
+CONFIG_SKIP_LOWLEVEL_INIT:
+       If you want to boot this system from SPI ROM and bypass e-bios (the
+       other boot loader on ROM). You should undefine CONFIG_SKIP_LOWLEVEL_INIT
+       in "include/configs/adp-ag102.h".
+
+Build and boot steps
+====================
+
+build:
+1. Prepare the toolchains and make sure the $PATH to toolchains is correct.
+2. Use `make adp-ag102` in u-boot root to build the image.
+
+Burn u-boot to SPI ROM:
+====================
+
+This section will be added later.
index f86e46c111fc4357ab888bacfa04dc2793fd04df..5dbdbe3672259c0d9a72bd79502fe99990f1cbde 100644 (file)
@@ -27,6 +27,7 @@ LIB   := $(obj)libi2c.o
 
 COBJS-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
 COBJS-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o
+COBJS-$(CONFIG_DW_I2C) += designware_i2c.o
 COBJS-$(CONFIG_FSL_I2C) += fsl_i2c.o
 COBJS-$(CONFIG_I2C_MVTWSI) += mvtwsi.o
 COBJS-$(CONFIG_I2C_MV) += mv_i2c.o
@@ -40,11 +41,11 @@ COBJS-$(CONFIG_PPC4XX_I2C) += ppc4xx_i2c.o
 COBJS-$(CONFIG_DRIVER_S3C24X0_I2C) += s3c24x0_i2c.o
 COBJS-$(CONFIG_S3C44B0_I2C) += s3c44b0_i2c.o
 COBJS-$(CONFIG_SOFT_I2C) += soft_i2c.o
-COBJS-$(CONFIG_SPEAR_I2C) += spr_i2c.o
 COBJS-$(CONFIG_TEGRA_I2C) += tegra_i2c.o
 COBJS-$(CONFIG_TSI108_I2C) += tsi108_i2c.o
 COBJS-$(CONFIG_U8500_I2C) += u8500_i2c.o
 COBJS-$(CONFIG_SH_I2C) += sh_i2c.o
+COBJS-$(CONFIG_SH_SH7734_I2C) += sh_sh7734_i2c.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
new file mode 100644 (file)
index 0000000..6d118ac
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+ * (C) Copyright 2009
+ * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+#include "designware_i2c.h"
+
+static struct i2c_regs *const i2c_regs_p =
+    (struct i2c_regs *)CONFIG_SYS_I2C_BASE;
+
+/*
+ * set_speed - Set the i2c speed mode (standard, high, fast)
+ * @i2c_spd:   required i2c speed mode
+ *
+ * Set the i2c speed mode (standard, high, fast)
+ */
+static void set_speed(int i2c_spd)
+{
+       unsigned int cntl;
+       unsigned int hcnt, lcnt;
+       unsigned int high, low;
+       unsigned int enbl;
+
+       /* to set speed cltr must be disabled */
+       enbl = readl(&i2c_regs_p->ic_enable);
+       enbl &= ~IC_ENABLE_0B;
+       writel(enbl, &i2c_regs_p->ic_enable);
+
+
+       cntl = (readl(&i2c_regs_p->ic_con) & (~IC_CON_SPD_MSK));
+
+       switch (i2c_spd) {
+       case IC_SPEED_MODE_MAX:
+               cntl |= IC_CON_SPD_HS;
+               high = MIN_HS_SCL_HIGHTIME;
+               low = MIN_HS_SCL_LOWTIME;
+               break;
+
+       case IC_SPEED_MODE_STANDARD:
+               cntl |= IC_CON_SPD_SS;
+               high = MIN_SS_SCL_HIGHTIME;
+               low = MIN_SS_SCL_LOWTIME;
+               break;
+
+       case IC_SPEED_MODE_FAST:
+       default:
+               cntl |= IC_CON_SPD_FS;
+               high = MIN_FS_SCL_HIGHTIME;
+               low = MIN_FS_SCL_LOWTIME;
+               break;
+       }
+
+       writel(cntl, &i2c_regs_p->ic_con);
+
+       hcnt = (IC_CLK * high) / NANO_TO_MICRO;
+       writel(hcnt, &i2c_regs_p->ic_fs_scl_hcnt);
+
+       lcnt = (IC_CLK * low) / NANO_TO_MICRO;
+       writel(lcnt, &i2c_regs_p->ic_fs_scl_lcnt);
+
+       /* re-enable i2c ctrl back now that speed is set */
+       enbl |= IC_ENABLE_0B;
+       writel(enbl, &i2c_regs_p->ic_enable);
+}
+
+/*
+ * i2c_set_bus_speed - Set the i2c speed
+ * @speed:     required i2c speed
+ *
+ * Set the i2c speed.
+ */
+void i2c_set_bus_speed(int speed)
+{
+       if (speed >= I2C_MAX_SPEED)
+               set_speed(IC_SPEED_MODE_MAX);
+       else if (speed >= I2C_FAST_SPEED)
+               set_speed(IC_SPEED_MODE_FAST);
+       else
+               set_speed(IC_SPEED_MODE_STANDARD);
+}
+
+/*
+ * i2c_get_bus_speed - Gets the i2c speed
+ *
+ * Gets the i2c speed.
+ */
+int i2c_get_bus_speed(void)
+{
+       u32 cntl;
+
+       cntl = (readl(&i2c_regs_p->ic_con) & IC_CON_SPD_MSK);
+
+       if (cntl == IC_CON_SPD_HS)
+               return I2C_MAX_SPEED;
+       else if (cntl == IC_CON_SPD_FS)
+               return I2C_FAST_SPEED;
+       else if (cntl == IC_CON_SPD_SS)
+               return I2C_STANDARD_SPEED;
+
+       return 0;
+}
+
+/*
+ * i2c_init - Init function
+ * @speed:     required i2c speed
+ * @slaveadd:  slave address for the device
+ *
+ * Initialization function.
+ */
+void i2c_init(int speed, int slaveadd)
+{
+       unsigned int enbl;
+
+       /* Disable i2c */
+       enbl = readl(&i2c_regs_p->ic_enable);
+       enbl &= ~IC_ENABLE_0B;
+       writel(enbl, &i2c_regs_p->ic_enable);
+
+       writel((IC_CON_SD | IC_CON_SPD_FS | IC_CON_MM), &i2c_regs_p->ic_con);
+       writel(IC_RX_TL, &i2c_regs_p->ic_rx_tl);
+       writel(IC_TX_TL, &i2c_regs_p->ic_tx_tl);
+       i2c_set_bus_speed(speed);
+       writel(IC_STOP_DET, &i2c_regs_p->ic_intr_mask);
+       writel(slaveadd, &i2c_regs_p->ic_sar);
+
+       /* Enable i2c */
+       enbl = readl(&i2c_regs_p->ic_enable);
+       enbl |= IC_ENABLE_0B;
+       writel(enbl, &i2c_regs_p->ic_enable);
+}
+
+/*
+ * i2c_setaddress - Sets the target slave address
+ * @i2c_addr:  target i2c address
+ *
+ * Sets the target slave address.
+ */
+static void i2c_setaddress(unsigned int i2c_addr)
+{
+       writel(i2c_addr, &i2c_regs_p->ic_tar);
+}
+
+/*
+ * i2c_flush_rxfifo - Flushes the i2c RX FIFO
+ *
+ * Flushes the i2c RX FIFO
+ */
+static void i2c_flush_rxfifo(void)
+{
+       while (readl(&i2c_regs_p->ic_status) & IC_STATUS_RFNE)
+               readl(&i2c_regs_p->ic_cmd_data);
+}
+
+/*
+ * i2c_wait_for_bb - Waits for bus busy
+ *
+ * Waits for bus busy
+ */
+static int i2c_wait_for_bb(void)
+{
+       unsigned long start_time_bb = get_timer(0);
+
+       while ((readl(&i2c_regs_p->ic_status) & IC_STATUS_MA) ||
+              !(readl(&i2c_regs_p->ic_status) & IC_STATUS_TFE)) {
+
+               /* Evaluate timeout */
+               if (get_timer(start_time_bb) > (unsigned long)(I2C_BYTE_TO_BB))
+                       return 1;
+       }
+
+       return 0;
+}
+
+/* check parameters for i2c_read and i2c_write */
+static int check_params(uint addr, int alen, uchar *buffer, int len)
+{
+       if (buffer == NULL) {
+               printf("Buffer is invalid\n");
+               return 1;
+       }
+
+       if (alen > 1) {
+               printf("addr len %d not supported\n", alen);
+               return 1;
+       }
+
+       if (addr + len > 256) {
+               printf("address out of range\n");
+               return 1;
+       }
+
+       return 0;
+}
+
+static int i2c_xfer_init(uchar chip, uint addr)
+{
+       if (i2c_wait_for_bb()) {
+               printf("Timed out waiting for bus\n");
+               return 1;
+       }
+
+       i2c_setaddress(chip);
+       writel(addr, &i2c_regs_p->ic_cmd_data);
+
+       return 0;
+}
+
+static int i2c_xfer_finish(void)
+{
+       ulong start_stop_det = get_timer(0);
+
+       while (1) {
+               if ((readl(&i2c_regs_p->ic_raw_intr_stat) & IC_STOP_DET)) {
+                       readl(&i2c_regs_p->ic_clr_stop_det);
+                       break;
+               } else if (get_timer(start_stop_det) > I2C_STOPDET_TO) {
+                       break;
+               }
+       }
+
+       if (i2c_wait_for_bb()) {
+               printf("Timed out waiting for bus\n");
+               return 1;
+       }
+
+       i2c_flush_rxfifo();
+
+       /* Wait for read/write operation to complete on actual memory */
+       udelay(10000);
+
+       return 0;
+}
+
+/*
+ * i2c_read - Read from i2c memory
+ * @chip:      target i2c address
+ * @addr:      address to read from
+ * @alen:
+ * @buffer:    buffer for read data
+ * @len:       no of bytes to be read
+ *
+ * Read from i2c memory.
+ */
+int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
+{
+       unsigned long start_time_rx;
+
+       if (check_params(addr, alen, buffer, len))
+               return 1;
+
+       if (i2c_xfer_init(chip, addr))
+               return 1;
+
+       start_time_rx = get_timer(0);
+       while (len) {
+               writel(IC_CMD, &i2c_regs_p->ic_cmd_data);
+
+               if (readl(&i2c_regs_p->ic_status) & IC_STATUS_RFNE) {
+                       *buffer++ = (uchar)readl(&i2c_regs_p->ic_cmd_data);
+                       len--;
+                       start_time_rx = get_timer(0);
+
+               } else if (get_timer(start_time_rx) > I2C_BYTE_TO) {
+                               printf("Timed out. i2c read Failed\n");
+                               return 1;
+               }
+       }
+
+       return i2c_xfer_finish();
+}
+
+/*
+ * i2c_write - Write to i2c memory
+ * @chip:      target i2c address
+ * @addr:      address to read from
+ * @alen:
+ * @buffer:    buffer for read data
+ * @len:       no of bytes to be read
+ *
+ * Write to i2c memory.
+ */
+int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
+{
+       int nb = len;
+       unsigned long start_time_tx;
+
+       if (check_params(addr, alen, buffer, len))
+               return 1;
+
+       if (i2c_xfer_init(chip, addr))
+               return 1;
+
+       start_time_tx = get_timer(0);
+       while (len) {
+               if (readl(&i2c_regs_p->ic_status) & IC_STATUS_TFNF) {
+                       writel(*buffer, &i2c_regs_p->ic_cmd_data);
+                       buffer++;
+                       len--;
+                       start_time_tx = get_timer(0);
+
+               } else if (get_timer(start_time_tx) > (nb * I2C_BYTE_TO)) {
+                               printf("Timed out. i2c write Failed\n");
+                               return 1;
+               }
+       }
+
+       return i2c_xfer_finish();
+}
+
+/*
+ * i2c_probe - Probe the i2c chip
+ */
+int i2c_probe(uchar chip)
+{
+       u32 tmp;
+
+       /*
+        * Try to read the first location of the chip.
+        */
+       return i2c_read(chip, 0, 1, (uchar *)&tmp, 1);
+}
diff --git a/drivers/i2c/designware_i2c.h b/drivers/i2c/designware_i2c.h
new file mode 100644 (file)
index 0000000..03b520e
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * (C) Copyright 2009
+ * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __DW_I2C_H_
+#define __DW_I2C_H_
+
+struct i2c_regs {
+       u32 ic_con;
+       u32 ic_tar;
+       u32 ic_sar;
+       u32 ic_hs_maddr;
+       u32 ic_cmd_data;
+       u32 ic_ss_scl_hcnt;
+       u32 ic_ss_scl_lcnt;
+       u32 ic_fs_scl_hcnt;
+       u32 ic_fs_scl_lcnt;
+       u32 ic_hs_scl_hcnt;
+       u32 ic_hs_scl_lcnt;
+       u32 ic_intr_stat;
+       u32 ic_intr_mask;
+       u32 ic_raw_intr_stat;
+       u32 ic_rx_tl;
+       u32 ic_tx_tl;
+       u32 ic_clr_intr;
+       u32 ic_clr_rx_under;
+       u32 ic_clr_rx_over;
+       u32 ic_clr_tx_over;
+       u32 ic_clr_rd_req;
+       u32 ic_clr_tx_abrt;
+       u32 ic_clr_rx_done;
+       u32 ic_clr_activity;
+       u32 ic_clr_stop_det;
+       u32 ic_clr_start_det;
+       u32 ic_clr_gen_call;
+       u32 ic_enable;
+       u32 ic_status;
+       u32 ic_txflr;
+       u32 ix_rxflr;
+       u32 reserved_1;
+       u32 ic_tx_abrt_source;
+};
+
+#define IC_CLK                 166
+#define NANO_TO_MICRO          1000
+
+/* High and low times in different speed modes (in ns) */
+#define MIN_SS_SCL_HIGHTIME    4000
+#define MIN_SS_SCL_LOWTIME     5000
+#define MIN_FS_SCL_HIGHTIME    800
+#define MIN_FS_SCL_LOWTIME     1700
+#define MIN_HS_SCL_HIGHTIME    60
+#define MIN_HS_SCL_LOWTIME     160
+
+/* Worst case timeout for 1 byte is kept as 2ms */
+#define I2C_BYTE_TO            (CONFIG_SYS_HZ/500)
+#define I2C_STOPDET_TO         (CONFIG_SYS_HZ/500)
+#define I2C_BYTE_TO_BB         (I2C_BYTE_TO * 16)
+
+/* i2c control register definitions */
+#define IC_CON_SD              0x0040
+#define IC_CON_RE              0x0020
+#define IC_CON_10BITADDRMASTER 0x0010
+#define IC_CON_10BITADDR_SLAVE 0x0008
+#define IC_CON_SPD_MSK         0x0006
+#define IC_CON_SPD_SS          0x0002
+#define IC_CON_SPD_FS          0x0004
+#define IC_CON_SPD_HS          0x0006
+#define IC_CON_MM              0x0001
+
+/* i2c target address register definitions */
+#define TAR_ADDR               0x0050
+
+/* i2c slave address register definitions */
+#define IC_SLAVE_ADDR          0x0002
+
+/* i2c data buffer and command register definitions */
+#define IC_CMD                 0x0100
+
+/* i2c interrupt status register definitions */
+#define IC_GEN_CALL            0x0800
+#define IC_START_DET           0x0400
+#define IC_STOP_DET            0x0200
+#define IC_ACTIVITY            0x0100
+#define IC_RX_DONE             0x0080
+#define IC_TX_ABRT             0x0040
+#define IC_RD_REQ              0x0020
+#define IC_TX_EMPTY            0x0010
+#define IC_TX_OVER             0x0008
+#define IC_RX_FULL             0x0004
+#define IC_RX_OVER             0x0002
+#define IC_RX_UNDER            0x0001
+
+/* fifo threshold register definitions */
+#define IC_TL0                 0x00
+#define IC_TL1                 0x01
+#define IC_TL2                 0x02
+#define IC_TL3                 0x03
+#define IC_TL4                 0x04
+#define IC_TL5                 0x05
+#define IC_TL6                 0x06
+#define IC_TL7                 0x07
+#define IC_RX_TL               IC_TL0
+#define IC_TX_TL               IC_TL0
+
+/* i2c enable register definitions */
+#define IC_ENABLE_0B           0x0001
+
+/* i2c status register  definitions */
+#define IC_STATUS_SA           0x0040
+#define IC_STATUS_MA           0x0020
+#define IC_STATUS_RFF          0x0010
+#define IC_STATUS_RFNE         0x0008
+#define IC_STATUS_TFE          0x0004
+#define IC_STATUS_TFNF         0x0002
+#define IC_STATUS_ACT          0x0001
+
+/* Speed Selection */
+#define IC_SPEED_MODE_STANDARD 1
+#define IC_SPEED_MODE_FAST     2
+#define IC_SPEED_MODE_MAX      3
+
+#define I2C_MAX_SPEED          3400000
+#define I2C_FAST_SPEED         400000
+#define I2C_STANDARD_SPEED     100000
+
+#endif /* __DW_I2C_H_ */
diff --git a/drivers/i2c/sh_sh7734_i2c.c b/drivers/i2c/sh_sh7734_i2c.c
new file mode 100644 (file)
index 0000000..9da173d
--- /dev/null
@@ -0,0 +1,387 @@
+/*
+ * Copyright (C) 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <asm/io.h>
+
+struct sh_i2c {
+       u8 iccr1;
+       u8 iccr2;
+       u8 icmr;
+       u8 icier;
+       u8 icsr;
+       u8 sar;
+       u8 icdrt;
+       u8 icdrr;
+       u8 nf2cyc;
+       u8 __pad0;
+       u8 __pad1;
+};
+
+static struct sh_i2c *base;
+static u8 iccr1_cks, nf2cyc;
+
+/* ICCR1 */
+#define SH_I2C_ICCR1_ICE       (1 << 7)
+#define SH_I2C_ICCR1_RCVD      (1 << 6)
+#define SH_I2C_ICCR1_MST       (1 << 5)
+#define SH_I2C_ICCR1_TRS       (1 << 4)
+#define SH_I2C_ICCR1_MTRS      \
+       (SH_I2C_ICCR1_MST | SH_I2C_ICCR1_TRS)
+
+/* ICCR1 */
+#define SH_I2C_ICCR2_BBSY      (1 << 7)
+#define SH_I2C_ICCR2_SCP       (1 << 6)
+#define SH_I2C_ICCR2_SDAO      (1 << 5)
+#define SH_I2C_ICCR2_SDAOP     (1 << 4)
+#define SH_I2C_ICCR2_SCLO      (1 << 3)
+#define SH_I2C_ICCR2_IICRST    (1 << 1)
+
+#define SH_I2C_ICIER_TIE       (1 << 7)
+#define SH_I2C_ICIER_TEIE      (1 << 6)
+#define SH_I2C_ICIER_RIE       (1 << 5)
+#define SH_I2C_ICIER_NAKIE     (1 << 4)
+#define SH_I2C_ICIER_STIE      (1 << 3)
+#define SH_I2C_ICIER_ACKE      (1 << 2)
+#define SH_I2C_ICIER_ACKBR     (1 << 1)
+#define SH_I2C_ICIER_ACKBT     (1 << 0)
+
+#define SH_I2C_ICSR_TDRE       (1 << 7)
+#define SH_I2C_ICSR_TEND       (1 << 6)
+#define SH_I2C_ICSR_RDRF       (1 << 5)
+#define SH_I2C_ICSR_NACKF      (1 << 4)
+#define SH_I2C_ICSR_STOP       (1 << 3)
+#define SH_I2C_ICSR_ALOVE      (1 << 2)
+#define SH_I2C_ICSR_AAS                (1 << 1)
+#define SH_I2C_ICSR_ADZ                (1 << 0)
+
+#define IRQ_WAIT 1000
+
+static void sh_i2c_send_stop(struct sh_i2c *base)
+{
+       clrbits_8(&base->iccr2, SH_I2C_ICCR2_BBSY | SH_I2C_ICCR2_SCP);
+}
+
+static int check_icsr_bits(struct sh_i2c *base, u8 bits)
+{
+       int i;
+
+       for (i = 0; i < IRQ_WAIT; i++) {
+               if (bits & readb(&base->icsr))
+                       return 0;
+               udelay(10);
+       }
+
+       return 1;
+}
+
+static int check_stop(struct sh_i2c *base)
+{
+       int ret = check_icsr_bits(base, SH_I2C_ICSR_STOP);
+       clrbits_8(&base->icsr, SH_I2C_ICSR_STOP);
+
+       return ret;
+}
+
+static int check_tend(struct sh_i2c *base, int stop)
+{
+       int ret = check_icsr_bits(base, SH_I2C_ICSR_TEND);
+
+       if (stop) {
+               clrbits_8(&base->icsr, SH_I2C_ICSR_STOP);
+               sh_i2c_send_stop(base);
+       }
+
+       clrbits_8(&base->icsr, SH_I2C_ICSR_TEND);
+       return ret;
+}
+
+static int check_tdre(struct sh_i2c *base)
+{
+       return check_icsr_bits(base, SH_I2C_ICSR_TDRE);
+}
+
+static int check_rdrf(struct sh_i2c *base)
+{
+       return check_icsr_bits(base, SH_I2C_ICSR_RDRF);
+}
+
+static int check_bbsy(struct sh_i2c *base)
+{
+       int i;
+
+       for (i = 0 ; i < IRQ_WAIT ; i++) {
+               if (!(SH_I2C_ICCR2_BBSY & readb(&base->iccr2)))
+                       return 0;
+               udelay(10);
+       }
+       return 1;
+}
+
+static int check_ackbr(struct sh_i2c *base)
+{
+       int i;
+
+       for (i = 0 ; i < IRQ_WAIT ; i++) {
+               if (!(SH_I2C_ICIER_ACKBR & readb(&base->icier)))
+                       return 0;
+               udelay(10);
+       }
+
+       return 1;
+}
+
+static void sh_i2c_reset(struct sh_i2c *base)
+{
+       setbits_8(&base->iccr2, SH_I2C_ICCR2_IICRST);
+
+       udelay(100);
+
+       clrbits_8(&base->iccr2, SH_I2C_ICCR2_IICRST);
+}
+
+static int i2c_set_addr(struct sh_i2c *base, u8 id, u8 reg)
+{
+       if (check_bbsy(base)) {
+               puts("i2c bus busy\n");
+               goto fail;
+       }
+
+       setbits_8(&base->iccr1, SH_I2C_ICCR1_MTRS);
+       clrsetbits_8(&base->iccr2, SH_I2C_ICCR2_SCP, SH_I2C_ICCR2_BBSY);
+
+       writeb((id << 1), &base->icdrt);
+
+       if (check_tend(base, 0)) {
+               puts("TEND check fail...\n");
+               goto fail;
+       }
+
+       if (check_ackbr(base)) {
+               check_tend(base, 0);
+               sh_i2c_send_stop(base);
+               goto fail;
+       }
+
+       writeb(reg, &base->icdrt);
+
+       if (check_tdre(base)) {
+               puts("TDRE check fail...\n");
+               goto fail;
+       }
+
+       if (check_tend(base, 0)) {
+               puts("TEND check fail...\n");
+               goto fail;
+       }
+
+       return 0;
+fail:
+
+       return 1;
+}
+
+static int
+i2c_raw_write(struct sh_i2c *base, u8 id, u8 reg, u8 *val, int size)
+{
+       int i;
+
+       if (i2c_set_addr(base, id, reg)) {
+               puts("Fail set slave address\n");
+               return 1;
+       }
+
+       for (i = 0; i < size; i++) {
+               writeb(val[i], &base->icdrt);
+               check_tdre(base);
+       }
+
+       check_tend(base, 1);
+       check_stop(base);
+
+       udelay(100);
+
+       clrbits_8(&base->iccr1, SH_I2C_ICCR1_MTRS);
+       clrbits_8(&base->icsr, SH_I2C_ICSR_TDRE);
+       sh_i2c_reset(base);
+
+       return 0;
+}
+
+static u8 i2c_raw_read(struct sh_i2c *base, u8 id, u8 reg)
+{
+       u8 ret = 0;
+
+       if (i2c_set_addr(base, id, reg)) {
+               puts("Fail set slave address\n");
+               goto fail;
+       }
+
+       clrsetbits_8(&base->iccr2, SH_I2C_ICCR2_SCP, SH_I2C_ICCR2_BBSY);
+       writeb((id << 1) | 1, &base->icdrt);
+
+       if (check_tend(base, 0))
+               puts("TDRE check fail...\n");
+
+       clrsetbits_8(&base->iccr1, SH_I2C_ICCR1_TRS, SH_I2C_ICCR1_MST);
+       clrbits_8(&base->icsr, SH_I2C_ICSR_TDRE);
+       setbits_8(&base->icier, SH_I2C_ICIER_ACKBT);
+       setbits_8(&base->iccr1, SH_I2C_ICCR1_RCVD);
+
+       /* read data (dummy) */
+       ret = readb(&base->icdrr);
+
+       if (check_rdrf(base)) {
+               puts("check RDRF error\n");
+               goto fail;
+       }
+
+       clrbits_8(&base->icsr, SH_I2C_ICSR_STOP);
+       udelay(1000);
+
+       sh_i2c_send_stop(base);
+
+       if (check_stop(base)) {
+               puts("check STOP error\n");
+               goto fail;
+       }
+
+       clrbits_8(&base->iccr1, SH_I2C_ICCR1_MTRS);
+       clrbits_8(&base->icsr, SH_I2C_ICSR_TDRE);
+
+       /* data read */
+       ret = readb(&base->icdrr);
+
+fail:
+       clrbits_8(&base->iccr1, SH_I2C_ICCR1_RCVD);
+
+       return ret;
+}
+
+#ifdef CONFIG_I2C_MULTI_BUS
+static unsigned int current_bus;
+
+/**
+ * i2c_set_bus_num - change active I2C bus
+ *     @bus: bus index, zero based
+ *     @returns: 0 on success, non-0 on failure
+ */
+int i2c_set_bus_num(unsigned int bus)
+{
+       switch (bus) {
+       case 0:
+               base = (void *)CONFIG_SH_I2C_BASE0;
+               break;
+       case 1:
+               base = (void *)CONFIG_SH_I2C_BASE1;
+               break;
+       default:
+               printf("Bad bus: %d\n", bus);
+               return -1;
+       }
+
+       current_bus = bus;
+
+       return 0;
+}
+
+/**
+ * i2c_get_bus_num - returns index of active I2C bus
+ */
+unsigned int i2c_get_bus_num(void)
+{
+       return current_bus;
+}
+#endif
+
+void i2c_init(int speed, int slaveaddr)
+{
+#ifdef CONFIG_I2C_MULTI_BUS
+       current_bus = 0;
+#endif
+       base = (struct sh_i2c *)CONFIG_SH_I2C_BASE0;
+
+       if (speed == 400000)
+               iccr1_cks = 0x07;
+       else
+               iccr1_cks = 0x0F;
+
+       nf2cyc = 1;
+
+       /* Reset */
+       sh_i2c_reset(base);
+
+       /* ICE enable and set clock */
+       writeb(SH_I2C_ICCR1_ICE | iccr1_cks, &base->iccr1);
+       writeb(nf2cyc, &base->nf2cyc);
+}
+
+/*
+ * i2c_read: - Read multiple bytes from an i2c device
+ *
+ * The higher level routines take into account that this function is only
+ * called with len < page length of the device (see configuration file)
+ *
+ * @chip:   address of the chip which is to be read
+ * @addr:   i2c data address within the chip
+ * @alen:   length of the i2c data address (1..2 bytes)
+ * @buffer: where to write the data
+ * @len:    how much byte do we want to read
+ * @return: 0 in case of success
+ */
+int i2c_read(u8 chip, u32 addr, int alen, u8 *buffer, int len)
+{
+       int i = 0;
+       for (i = 0; i < len; i++)
+               buffer[i] = i2c_raw_read(base, chip, addr + i);
+
+       return 0;
+}
+
+/*
+ * i2c_write: -  Write multiple bytes to an i2c device
+ *
+ * The higher level routines take into account that this function is only
+ * called with len < page length of the device (see configuration file)
+ *
+ * @chip:   address of the chip which is to be written
+ * @addr:   i2c data address within the chip
+ * @alen:   length of the i2c data address (1..2 bytes)
+ * @buffer: where to find the data to be written
+ * @len:    how much byte do we want to read
+ * @return: 0 in case of success
+ */
+int i2c_write(u8 chip, u32 addr, int alen, u8 *buffer, int len)
+{
+       return i2c_raw_write(base, chip, addr, buffer, len);
+}
+
+/*
+ * i2c_probe: - Test if a chip answers for a given i2c address
+ *
+ * @chip:   address of the chip which is searched for
+ * @return: 0 if a chip was found, -1 otherwhise
+ */
+int i2c_probe(u8 chip)
+{
+       u8 byte;
+       return i2c_read(chip, 0, 0, &byte, 1);
+}
diff --git a/drivers/i2c/spr_i2c.c b/drivers/i2c/spr_i2c.c
deleted file mode 100644 (file)
index eabfe84..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * (C) Copyright 2009
- * Vipin Kumar, ST Micoelectronics, vipin.kumar@st.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/spr_i2c.h>
-
-static struct i2c_regs *const i2c_regs_p =
-    (struct i2c_regs *)CONFIG_SYS_I2C_BASE;
-
-/*
- * set_speed - Set the i2c speed mode (standard, high, fast)
- * @i2c_spd:   required i2c speed mode
- *
- * Set the i2c speed mode (standard, high, fast)
- */
-static void set_speed(int i2c_spd)
-{
-       unsigned int cntl;
-       unsigned int hcnt, lcnt;
-       unsigned int high, low;
-
-       cntl = (readl(&i2c_regs_p->ic_con) & (~IC_CON_SPD_MSK));
-
-       switch (i2c_spd) {
-       case IC_SPEED_MODE_MAX:
-               cntl |= IC_CON_SPD_HS;
-               high = MIN_HS_SCL_HIGHTIME;
-               low = MIN_HS_SCL_LOWTIME;
-               break;
-
-       case IC_SPEED_MODE_STANDARD:
-               cntl |= IC_CON_SPD_SS;
-               high = MIN_SS_SCL_HIGHTIME;
-               low = MIN_SS_SCL_LOWTIME;
-               break;
-
-       case IC_SPEED_MODE_FAST:
-       default:
-               cntl |= IC_CON_SPD_FS;
-               high = MIN_FS_SCL_HIGHTIME;
-               low = MIN_FS_SCL_LOWTIME;
-               break;
-       }
-
-       writel(cntl, &i2c_regs_p->ic_con);
-
-       hcnt = (IC_CLK * high) / NANO_TO_MICRO;
-       writel(hcnt, &i2c_regs_p->ic_fs_scl_hcnt);
-
-       lcnt = (IC_CLK * low) / NANO_TO_MICRO;
-       writel(lcnt, &i2c_regs_p->ic_fs_scl_lcnt);
-}
-
-/*
- * i2c_set_bus_speed - Set the i2c speed
- * @speed:     required i2c speed
- *
- * Set the i2c speed.
- */
-void i2c_set_bus_speed(int speed)
-{
-       if (speed >= I2C_MAX_SPEED)
-               set_speed(IC_SPEED_MODE_MAX);
-       else if (speed >= I2C_FAST_SPEED)
-               set_speed(IC_SPEED_MODE_FAST);
-       else
-               set_speed(IC_SPEED_MODE_STANDARD);
-}
-
-/*
- * i2c_get_bus_speed - Gets the i2c speed
- *
- * Gets the i2c speed.
- */
-int i2c_get_bus_speed(void)
-{
-       u32 cntl;
-
-       cntl = (readl(&i2c_regs_p->ic_con) & IC_CON_SPD_MSK);
-
-       if (cntl == IC_CON_SPD_HS)
-               return I2C_MAX_SPEED;
-       else if (cntl == IC_CON_SPD_FS)
-               return I2C_FAST_SPEED;
-       else if (cntl == IC_CON_SPD_SS)
-               return I2C_STANDARD_SPEED;
-
-       return 0;
-}
-
-/*
- * i2c_init - Init function
- * @speed:     required i2c speed
- * @slaveadd:  slave address for the spear device
- *
- * Initialization function.
- */
-void i2c_init(int speed, int slaveadd)
-{
-       unsigned int enbl;
-
-       /* Disable i2c */
-       enbl = readl(&i2c_regs_p->ic_enable);
-       enbl &= ~IC_ENABLE_0B;
-       writel(enbl, &i2c_regs_p->ic_enable);
-
-       writel((IC_CON_SD | IC_CON_SPD_FS | IC_CON_MM), &i2c_regs_p->ic_con);
-       writel(IC_RX_TL, &i2c_regs_p->ic_rx_tl);
-       writel(IC_TX_TL, &i2c_regs_p->ic_tx_tl);
-       i2c_set_bus_speed(speed);
-       writel(IC_STOP_DET, &i2c_regs_p->ic_intr_mask);
-       writel(slaveadd, &i2c_regs_p->ic_sar);
-
-       /* Enable i2c */
-       enbl = readl(&i2c_regs_p->ic_enable);
-       enbl |= IC_ENABLE_0B;
-       writel(enbl, &i2c_regs_p->ic_enable);
-}
-
-/*
- * i2c_setaddress - Sets the target slave address
- * @i2c_addr:  target i2c address
- *
- * Sets the target slave address.
- */
-static void i2c_setaddress(unsigned int i2c_addr)
-{
-       writel(i2c_addr, &i2c_regs_p->ic_tar);
-}
-
-/*
- * i2c_flush_rxfifo - Flushes the i2c RX FIFO
- *
- * Flushes the i2c RX FIFO
- */
-static void i2c_flush_rxfifo(void)
-{
-       while (readl(&i2c_regs_p->ic_status) & IC_STATUS_RFNE)
-               readl(&i2c_regs_p->ic_cmd_data);
-}
-
-/*
- * i2c_wait_for_bb - Waits for bus busy
- *
- * Waits for bus busy
- */
-static int i2c_wait_for_bb(void)
-{
-       unsigned long start_time_bb = get_timer(0);
-
-       while ((readl(&i2c_regs_p->ic_status) & IC_STATUS_MA) ||
-              !(readl(&i2c_regs_p->ic_status) & IC_STATUS_TFE)) {
-
-               /* Evaluate timeout */
-               if (get_timer(start_time_bb) > (unsigned long)(I2C_BYTE_TO_BB))
-                       return 1;
-       }
-
-       return 0;
-}
-
-/* check parameters for i2c_read and i2c_write */
-static int check_params(uint addr, int alen, uchar *buffer, int len)
-{
-       if (buffer == NULL) {
-               printf("Buffer is invalid\n");
-               return 1;
-       }
-
-       if (alen > 1) {
-               printf("addr len %d not supported\n", alen);
-               return 1;
-       }
-
-       if (addr + len > 256) {
-               printf("address out of range\n");
-               return 1;
-       }
-
-       return 0;
-}
-
-static int i2c_xfer_init(uchar chip, uint addr)
-{
-       if (i2c_wait_for_bb()) {
-               printf("Timed out waiting for bus\n");
-               return 1;
-       }
-
-       i2c_setaddress(chip);
-       writel(addr, &i2c_regs_p->ic_cmd_data);
-
-       return 0;
-}
-
-static int i2c_xfer_finish(void)
-{
-       ulong start_stop_det = get_timer(0);
-
-       while (1) {
-               if ((readl(&i2c_regs_p->ic_raw_intr_stat) & IC_STOP_DET)) {
-                       readl(&i2c_regs_p->ic_clr_stop_det);
-                       break;
-               } else if (get_timer(start_stop_det) > I2C_STOPDET_TO) {
-                       break;
-               }
-       }
-
-       if (i2c_wait_for_bb()) {
-               printf("Timed out waiting for bus\n");
-               return 1;
-       }
-
-       i2c_flush_rxfifo();
-
-       /* Wait for read/write operation to complete on actual memory */
-       udelay(10000);
-
-       return 0;
-}
-
-/*
- * i2c_read - Read from i2c memory
- * @chip:      target i2c address
- * @addr:      address to read from
- * @alen:
- * @buffer:    buffer for read data
- * @len:       no of bytes to be read
- *
- * Read from i2c memory.
- */
-int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
-       unsigned long start_time_rx;
-
-       if (check_params(addr, alen, buffer, len))
-               return 1;
-
-       if (i2c_xfer_init(chip, addr))
-               return 1;
-
-       start_time_rx = get_timer(0);
-       while (len) {
-               writel(IC_CMD, &i2c_regs_p->ic_cmd_data);
-
-               if (readl(&i2c_regs_p->ic_status) & IC_STATUS_RFNE) {
-                       *buffer++ = (uchar)readl(&i2c_regs_p->ic_cmd_data);
-                       len--;
-                       start_time_rx = get_timer(0);
-
-               } else if (get_timer(start_time_rx) > I2C_BYTE_TO) {
-                               printf("Timed out. i2c read Failed\n");
-                               return 1;
-               }
-       }
-
-       return i2c_xfer_finish();
-}
-
-/*
- * i2c_write - Write to i2c memory
- * @chip:      target i2c address
- * @addr:      address to read from
- * @alen:
- * @buffer:    buffer for read data
- * @len:       no of bytes to be read
- *
- * Write to i2c memory.
- */
-int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
-{
-       int nb = len;
-       unsigned long start_time_tx;
-
-       if (check_params(addr, alen, buffer, len))
-               return 1;
-
-       if (i2c_xfer_init(chip, addr))
-               return 1;
-
-       start_time_tx = get_timer(0);
-       while (len) {
-               if (readl(&i2c_regs_p->ic_status) & IC_STATUS_TFNF) {
-                       writel(*buffer, &i2c_regs_p->ic_cmd_data);
-                       buffer++;
-                       len--;
-                       start_time_tx = get_timer(0);
-
-               } else if (get_timer(start_time_tx) > (nb * I2C_BYTE_TO)) {
-                               printf("Timed out. i2c write Failed\n");
-                               return 1;
-               }
-       }
-
-       return i2c_xfer_finish();
-}
-
-/*
- * i2c_probe - Probe the i2c chip
- */
-int i2c_probe(uchar chip)
-{
-       u32 tmp;
-
-       /*
-        * Try to read the first location of the chip.
-        */
-       return i2c_read(chip, 0, 1, (uchar *)&tmp, 1);
-}
index 08fc5c1d3e61d66d4daac74f0b5086917f2ce4a7..8d59d46c646878b866834bf72eb9649c1e2b5f4f 100644 (file)
@@ -256,7 +256,6 @@ int bfin_mmc_init(bd_t *bis)
        mmc->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
        mmc->f_max = get_sclk();
        mmc->f_min = mmc->f_max >> 9;
-       mmc->block_dev.part_type = PART_TYPE_DOS;
 
        mmc->b_max = 0;
 
index 2c6b8295fb88f1c5a673bfb1c08f86a667c92fb2..55f4f7a30b2a8a3227c021cf2ece323c1dda4f37 100644 (file)
@@ -15,7 +15,6 @@
 
 #define CONFIG_CMD_AMBAPP      /* AMBA Plug & Play Bus print utility */
 #define CONFIG_CMD_ASKENV      /* ask for env variable         */
-#define CONFIG_CMD_AT91_SPIMUX /* AT91 MMC/SPI Mux Support     */
 #define CONFIG_CMD_BDI         /* bdinfo                       */
 #define CONFIG_CMD_BEDBUG      /* Include BedBug Debugger      */
 #define CONFIG_CMD_BMP         /* BMP support                  */
index 01597b965b6ce16e2584b640eee76336050988d8..f08d78b91c22520720895f78e70ecd2b6ddb5aab 100644 (file)
@@ -422,7 +422,7 @@ const char *hww1u1a_get_ps1(void);
 #define CONFIG_MD5
 #define CONFIG_SHA1
 #define CONFIG_CMD_MD5SUM
-#define CONFIG_CMD_SHA1
+#define CONFIG_CMD_SHA1SUM
 #define CONFIG_CMD_ASKENV
 #define CONFIG_CMD_SETEXPR
 
index cb5b023b58fed55c7255c3e540ba8842e78a335a..79780bd1a361ee64f70a1530f77941813cdb004c 100644 (file)
@@ -87,7 +87,6 @@
  * Command line configuration.
  */
 #define CONFIG_CMD_NET
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_PCMCIA
 #define CONFIG_CMD_IDE
index 619a8002a73267c43770c1a705397439a96a1de9..84ba78f9e962e9443ab2c9499cd1c0225ed961e5 100644 (file)
@@ -38,7 +38,6 @@
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_NFS
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SAVEENV
 
diff --git a/include/configs/adp-ag102.h b/include/configs/adp-ag102.h
new file mode 100644 (file)
index 0000000..a4628e4
--- /dev/null
@@ -0,0 +1,375 @@
+/*
+ * Copyright (C) 2011 Andes Technology Corporation
+ * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <asm/arch/ag102.h>
+
+/*
+ * CPU and Board Configuration Options
+ */
+#define CONFIG_ADP_AG102
+
+#define CONFIG_USE_INTERRUPT
+
+#define CONFIG_SKIP_LOWLEVEL_INIT
+
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_MEM_REMAP
+#endif
+
+#ifdef CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_SYS_TEXT_BASE   0x04200000
+#else
+#define CONFIG_SYS_TEXT_BASE   0x00000000
+#endif
+
+/*
+ * Timer
+ */
+
+/*
+ * According to the discussion in u-boot mailing list before,
+ * CONFIG_SYS_HZ at 1000 is mandatory.
+ */
+#define CONFIG_SYS_HZ          1000
+#define CONFIG_SYS_CLK_FREQ    (66000000 * 2)
+#define VERSION_CLOCK          CONFIG_SYS_CLK_FREQ
+
+/*
+ * Use Externel CLOCK or PCLK
+ */
+#undef CONFIG_FTRTC010_EXTCLK
+
+#ifndef CONFIG_FTRTC010_EXTCLK
+#define CONFIG_FTRTC010_PCLK
+#endif
+
+#ifdef CONFIG_FTRTC010_EXTCLK
+#define TIMER_CLOCK    32768                   /* CONFIG_FTRTC010_EXTCLK */
+#else
+#define TIMER_CLOCK    CONFIG_SYS_HZ           /* CONFIG_FTRTC010_PCLK */
+#endif
+
+#define TIMER_LOAD_VAL 0xffffffff
+
+/*
+ * Real Time Clock
+ */
+#define CONFIG_RTC_FTRTC010
+
+/*
+ * Real Time Clock Divider
+ * RTC_DIV_COUNT                       (OSC_CLK/OSC_5MHZ)
+ */
+#define OSC_5MHZ                       (5*1000000)
+#define OSC_CLK                                (2*OSC_5MHZ)
+#define RTC_DIV_COUNT                  (OSC_CLK/OSC_5MHZ)
+
+/*
+ * Serial console configuration
+ */
+
+/* FTUART is a high speed NS 16C550A compatible UART */
+#define CONFIG_BAUDRATE                        38400
+#define CONFIG_CONS_INDEX              1
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_COM1                CONFIG_FTUART010_01_BASE
+#define CONFIG_SYS_NS16550_REG_SIZE    -4
+#define CONFIG_SYS_NS16550_CLK         33000000        /* AG102 */
+
+/* valid baudrates */
+#define CONFIG_SYS_BAUDRATE_TABLE      { 9600, 19200, 38400, 57600, 115200 }
+
+/*
+ * Ethernet
+ */
+#define CONFIG_NET_MULTI
+#define CONFIG_PHY_MAX_ADDR    32      /* this comes from <linux/phy.h> */
+#define CONFIG_SYS_DISCOVER_PHY
+#define CONFIG_FTGMAC100
+#define CONFIG_FTGMAC100_EGIGA
+
+#define CONFIG_BOOTDELAY       3
+
+/*
+ * SD (MMC) controller
+ */
+#define CONFIG_MMC
+#define CONFIG_CMD_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_DOS_PARTITION
+#define CONFIG_FTSDC010
+#define CONFIG_FTSDC010_NUMBER         1
+#define CONFIG_FTSDC010_SDIO
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT2
+
+/*
+ * Command line configuration.
+ */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_CACHE
+#define CONFIG_CMD_DATE
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_IDE
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_ELF
+
+#undef CONFIG_CMD_FLASH
+#undef CONFIG_CMD_IMLS
+
+/*
+ * PCI
+ */
+#define CONFIG_PCI
+#define CONFIG_FTPCI100
+#define CONFIG_FTPCI100_MEM_BASE        0xa0000000
+#define CONFIG_FTPCI100_IO_SIZE         FTPCI100_BASE_IO_SIZE(256) /* 256M */
+#define CONFIG_FTPCI100_MEM_SIZE        FTPCI100_MEM_SIZE(128)  /* 128M */
+#define CONFIG_FTPCI100_MEM_BASE_SIZE1  0x50
+
+#define CONFIG_PCI_MEM_BUS     0xa0000000
+#define CONFIG_PCI_MEM_PHYS    CONFIG_PCI_MEM_BUS
+#define CONFIG_PCI_MEM_SIZE    0x01000000              /* 256M */
+
+#define CONFIG_PCI_IO_BUS      0x90000000
+#define CONFIG_PCI_IO_PHYS     CONFIG_PCI_IO_BUS
+#define CONFIG_PCI_IO_SIZE     0x00100000              /* 1M */
+
+/*
+ * USB
+ */
+#if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI)
+#if defined(CONFIG_FTPCI100)
+#define __io /* enable outl & inl */
+#define CONFIG_CMD_USB
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS      5
+#define CONFIG_USB_STORAGE
+#define CONFIG_USB_EHCI
+#define CONFIG_PCI_EHCI_DEVICE 0
+#define CONFIG_USB_EHCI_PCI
+#define CONFIG_PREBOOT                          "usb start;"
+#endif /* #if defiend(CONFIG_FTPCI100) */
+#endif /* #if defined(CONFIG_CMD_PCI) || defined(CONFIG_PCI) */
+
+/*
+ * IDE/ATA stuff
+ */
+#define __io
+#define CONFIG_IDE_AHB
+#define CONFIG_IDE_FTIDE020
+
+#undef CONFIG_IDE_8xx_DIRECT           /* no pcmcia interface required */
+#undef CONFIG_IDE_LED                  /* no led for ide supported     */
+#define CONFIG_IDE_RESET       1       /* reset for ide supported      */
+#define CONFIG_IDE_PREINIT     1       /* preinit for ide              */
+
+/* max: 2 IDE busses */
+#define CONFIG_SYS_IDE_MAXBUS          1       /* origin: 2 */
+/* max: 2 drives per IDE bus */
+#define CONFIG_SYS_IDE_MAXDEVICE       1       /* origin: (MAXBUS * 2) */
+
+#define CONFIG_SYS_ATA_BASE_ADDR       CONFIG_FTIDE020S_BASE
+#define CONFIG_SYS_ATA_IDE0_OFFSET     0x0000
+#define CONFIG_SYS_ATA_IDE1_OFFSET     0x0000
+
+#define CONFIG_SYS_ATA_DATA_OFFSET     0x0000  /* for data I/O */
+#define CONFIG_SYS_ATA_REG_OFFSET      0x0000  /* for normal regs access */
+#define CONFIG_SYS_ATA_ALT_OFFSET      0x0000  /* for alternate regs */
+
+#define CONFIG_MAC_PARTITION
+#define CONFIG_DOS_PARTITION
+#define CONFIG_SUPPORT_VFAT
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP                    /* undef to save memory */
+#define CONFIG_SYS_PROMPT      "NDS32 # "      /* Monitor Command Prompt */
+#define CONFIG_SYS_CBSIZE      256             /* Console I/O Buffer Size */
+
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE      \
+       (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
+
+/* max number of command args */
+#define CONFIG_SYS_MAXARGS     16
+
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE
+
+/*
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE       (128 * 1024)    /* regular stack */
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN          (CONFIG_ENV_SIZE + 128 * 1024)
+
+/*
+ * size in bytes reserved for initial data
+*/
+#define CONFIG_SYS_GBL_DATA_SIZE       128
+
+/*
+ * AHB Controller configuration
+ */
+#define CONFIG_FTAHBC020S
+
+#ifdef CONFIG_FTAHBC020S
+#include <faraday/ftahbc020s.h>
+
+/* Address of PHYS_SDRAM_0 before memory remap is at 0x(100)00000 */
+#define CONFIG_SYS_FTAHBC020S_SLAVE_BSR_BASE   0x100
+
+/*
+ * CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6: this define is used in lowlevel_init.S,
+ * hence we cannot use FTAHBC020S_BSR_SIZE(2048) since it will use ffs() wrote
+ * in C language.
+ */
+#define CONFIG_SYS_FTAHBC020S_SLAVE_BSR_6 \
+       (FTAHBC020S_SLAVE_BSR_BASE(CONFIG_SYS_FTAHBC020S_SLAVE_BSR_BASE) | \
+                                        FTAHBC020S_SLAVE_BSR_SIZE(0xb))
+#endif
+
+/*
+ * Watchdog
+ */
+#define CONFIG_FTWDT010_WATCHDOG
+
+/*
+ * PCU Power Control Unit configuration
+ */
+#define CONFIG_ANDES_PCU
+
+#ifdef CONFIG_ANDES_PCU
+#include <andestech/andes_pcu.h>
+
+#endif
+
+/*
+ * DDR DRAM controller configuration
+ */
+#define CONFIG_DWCDDR21MCTL
+
+#ifdef CONFIG_DWCDDR21MCTL
+#include <synopsys/dwcddr21mctl.h>
+/* DCR:
+ *   2GB: 0x000025d2, 2GB (1Gb x8 2 ranks) Micron/innoDisk/Transcend
+ *   1GB: 0x000021d2, 1GB (1Gb x8 1 rank) Micron/Transcend/innoDisk
+ * 512MB: 0x000025cc, Micron 512MB (512Mb x16 2 ranks)
+ * 512MB: 0x000021ca, Trenscend/innoDisk 512MB (512Mb x8 1 rank)
+ * 256MB: 0x000020d4, Micron 256MB (1Gb x16 1 ranks)
+ */
+#define CONFIG_SYS_DWCDDR21MCTL_CCR    0x00020004
+#define CONFIG_SYS_DWCDDR21MCTL_CCR2   (DWCDDR21MCTL_CCR_DTT(0x1)      | \
+                                       DWCDDR21MCTL_CCR_DFTLM(0x4)     | \
+                                       DWCDDR21MCTL_CCR_HOSTEN(0x1))
+
+/* 0x04: 0x000020d4 */
+#define CONFIG_SYS_DWCDDR21MCTL_DCR    0x000020ca
+
+/* 0x08: 0x0000000f */
+#define CONFIG_SYS_DWCDDR21MCTL_IOCR   0x0000000f
+
+/* 0x10: 0x00034812 */
+#define CONFIG_SYS_DWCDDR21MCTL_DRR    (DWCDDR21MCTL_DRR_TRFC(0x12)    | \
+                                       DWCDDR21MCTL_DRR_TRFPRD(0x0348))
+/* 0x24 */
+#define CONFIG_SYS_DWCDDR21MCTL_DLLCR0 DWCDDR21MCTL_DLLCR_PHASE(0x0)
+
+/* 0x4c: 0x00000040 */
+#define CONFIG_SYS_DWCDDR21MCTL_RSLR0  0x00000040
+
+/* 0x5c: 0x000055CF */
+#define CONFIG_SYS_DWCDDR21MCTL_RDGR0  0x000055cf
+
+/* 0xa4: 0x00100000 */
+#define CONFIG_SYS_DWCDDR21MCTL_DTAR   (DWCDDR21MCTL_DTAR_DTBANK(0x0)  | \
+                                       DWCDDR21MCTL_DTAR_DTROW(0x0100) | \
+                                       DWCDDR21MCTL_DTAR_DTCOL(0x0))
+/* 0x1f0: 0x00000852 */
+#define CONFIG_SYS_DWCDDR21MCTL_MR     (DWCDDR21MCTL_MR_WR(0x4)        | \
+                                       DWCDDR21MCTL_MR_CL(0x5)         | \
+                                       DWCDDR21MCTL_MR_BL(0x2))
+#endif
+
+/*
+ * Physical Memory Map
+ */
+#if defined(CONFIG_MEM_REMAP) || defined(CONFIG_SKIP_LOWLEVEL_INIT)
+#define PHYS_SDRAM_0           0x00000000      /* SDRAM Bank #1 */
+#if defined(CONFIG_MEM_REMAP)
+#define PHYS_SDRAM_0_AT_INIT   0x80000000      /* SDRAM Bank #1 before remap*/
+#endif
+#else  /* !CONFIG_SKIP_LOWLEVEL_INIT && !CONFIG_MEM_REMAP */
+#define PHYS_SDRAM_0           0x80000000      /* SDRAM Bank #1 */
+#endif
+
+#define CONFIG_NR_DRAM_BANKS   1               /* we have 1 bank of DRAM */
+#define PHYS_SDRAM_0_SIZE      0x10000000      /* 256 MB */
+
+#define CONFIG_SYS_SDRAM_BASE          PHYS_SDRAM_0
+
+#ifdef CONFIG_MEM_REMAP
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0xA0000 - \
+                                       GENERATED_GBL_DATA_SIZE)
+#else
+#define CONFIG_SYS_INIT_SP_ADDR                (CONFIG_SYS_SDRAM_BASE + 0x1000 - \
+                                       GENERATED_GBL_DATA_SIZE)
+#endif /* CONFIG_MEM_REMAP */
+
+/*
+ * Load address and memory test area should agree with
+ * board/faraday/a320/config.mk
+ * Be careful not to overwrite U-boot itself.
+ */
+#define CONFIG_SYS_LOAD_ADDR           0x0CF00000
+
+/* memtest works on 63 MB in DRAM */
+#define CONFIG_SYS_MEMTEST_START       PHYS_SDRAM_0
+#define CONFIG_SYS_MEMTEST_END         (PHYS_SDRAM_0 + 0x03F00000)
+
+/*
+ * Static memory controller configuration
+ */
+
+/*
+ * FLASH and environment organization
+ */
+#define CONFIG_SYS_NO_FLASH
+
+/*
+ * Env Storage Settings
+ */
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_ENV_SIZE                        4096
+
+#endif /* __CONFIG_H */
index 6a02188108f0c4a2a3135457b3d2793e2ce01306..159857d32f1941caf5b9d92d4983f93c193228e1 100644 (file)
 #undef CONFIG_CMD_FPGA
 #undef CONFIG_CMD_IMI
 #undef CONFIG_CMD_IMLS
-#undef CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_LOADS
 
 #define CONFIG_CMD_PING
index 60c7c4058f87a3ad19ec2aca9775dec528b5ed13..303630d7d772aecd69103c33a6757165785cacec 100644 (file)
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_JFFS2
-#define CONFIG_CMD_KGBD
+#define CONFIG_CMD_KGDB
 #define CONFIG_CMD_PCI
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_SAVES
index d5173349c4bbd12263f7874eabf8e563bba9783d..1f660235f02a036627b5026c51e23906764857b4 100644 (file)
 #ifdef CONFIG_VIDEO
 #define CONFIG_CMD_BMP
 #endif
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_DATE
 #define CONFIG_CMD_DHCP
index f19360d501220cb79bf6c1d11141eae2c86bf5ec..221d3e055d74f07143fc6537abef9960c3435d00 100644 (file)
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SNTP
 
-#undef CONFIG_CMD_DCR
 #undef CONFIG_CMD_XIMG
 
 /* Where do the internal registers live? */
index 462cc7e16c8117576f4879139e4f026fda18b2f3..efff3098a5014963c4a1acc95943fead96e21c3d 100644 (file)
@@ -70,7 +70,6 @@
 #define CONFIG_SYS_NO_FLASH            /* Declare no flash (NOR/SPI) */
 #include <config_cmd_default.h>
 #define CONFIG_CMD_I2C
-#define CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_FPGA
 #define CONFIG_CMD_USB
 #define CONFIG_CMD_EXT2
index f72ee02abfa70d5e4e6f4d7cfb0bce8c1bf490f0..d644fea22f47f2f852493340e2677b2739ca1175 100644 (file)
 #undef CONFIG_CMD_XIMG
 
 #define CONFIG_CMD_BMP
-#define CONFIG_CMD_CAN
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_FAT
index 621dbb8fa67fe74c7e06d4db187d2bd3f0aaec17..d505a41de4510596c8e5c1c13df4d4bcc0f9610a 100644 (file)
  */
 #define CONFIG_CMD_CHIP_CONFIG
 #define CONFIG_CMD_DATE
-#define CONFIG_CMD_LOG
 #define CONFIG_CMD_NAND
 #define CONFIG_CMD_PCI
 #define CONFIG_CMD_SNTP
index a6f2864c6593733f57a8738b10aa534287ab5f0d..68215fda9d263023bf2085e554b6b1aaefa91f11 100644 (file)
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_IRQ
-#define CONFIG_CMD_LOG
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_NFS
index fcc789d714158349b5cd6c11b6eec943f6ad1215..6c1b136659abae34d237de17600e1aac3f95cf4c 100644 (file)
  */
 #define CONFIG_CMD_DATE
 #define CONFIG_CMD_DTT
-#define CONFIG_CMD_LOG
 #define CONFIG_CMD_PCI
 #define CONFIG_CMD_SNTP
 
index 7cf641fd13b91c7d909d831d0f1efa57895fbb90..f1104902be4357e14eda81277b7bd4b206956c98 100644 (file)
@@ -35,7 +35,6 @@
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_NFS
 #define CONFIG_CMD_PING
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_MEMORY
 #define CONFIG_CMD_SAVEENV
index 03f52f39055180b7ecdc9529997497f33d6cab54..52e15cce876419075d93aaaeb36ac092a7c11508 100644 (file)
@@ -38,7 +38,6 @@
  */
 /*#include <config_cmd_default.h>*/
 
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_FLASH
 #define CONFIG_CMD_SAVEENV
 
index 01360f6cbd6b38843593b253e5229ba9a800105c..4ac17cc63658c18092bcfd234f5acd1c53068d98 100644 (file)
 #define CONFIG_CMD_NET      /* bootp, tftpboot, rarpboot    */
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
-#define CONFIG_CMD_SETECPR     /* Evaluate expressions         */
+#define CONFIG_CMD_SETEXPR     /* Evaluate expressions         */
 
 #undef CONFIG_CMD_FLASH                /* flinfo, erase, protect       */
 #undef CONFIG_CMD_FPGA         /* FPGA configuration Support   */
index dc5ec3aa823dc3d3f957840b3b69e3e2edcedb24..5d0c3859877ca0a91354d312e53c5679744cda31 100644 (file)
@@ -69,7 +69,6 @@
 #define CONFIG_CMD_I2C
 #undef CONFIG_CMD_IRQ
 #define CONFIG_CMD_JFFS2
-#undef CONFIG_CMD_LOG
 #undef CONFIG_CMD_MII
 #define CONFIG_CMD_NAND
 #undef CONFIG_CMD_PING
index 0ce3fa864c7f679dd93a13fc7da60fb0042fd4df..9cdfc147e956f4e9d34dcd4f9b3278624fb93637 100644 (file)
@@ -15,7 +15,6 @@
  */
 #include <config_cmd_default.h>
 
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_FLASH
 #define CONFIG_CMD_PCI
index 73d2a8759678059f86ac5ee861cf3957c970f011..708bff7bb70ff1e1a6aedfd3e1f15320c3a1da55 100644 (file)
@@ -41,7 +41,6 @@
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_NFS
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_SF
 #define CONFIG_CMD_RUN
index 1e71bcc3effb4b6c767d1f3bacc2ac8c040f09ad..9c32bfc58bb1f5d8ef0f78c1db944dd0c3ee9f11 100644 (file)
@@ -37,7 +37,6 @@
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_NFS
-#define CONFIG_CMD_DFL
 #define CONFIG_CMD_SDRAM
 #define CONFIG_CMD_RUN
 #define CONFIG_CMD_SAVEENV
index 5fef8cce808c339c45617e6df9dd26f2fc09661d..a79181565e2694dde472821a72acd777a3d4fe11 100644 (file)
@@ -41,7 +41,7 @@
 
 /* I2C driver configuration */
 #define CONFIG_HARD_I2C
-#define CONFIG_SPEAR_I2C
+#define CONFIG_DW_I2C
 #define CONFIG_SYS_I2C_SPEED                   400000
 #define CONFIG_SYS_I2C_SLAVE                   0x02
 
index 4747fbd351ba660b99640fcf20c68bb21d9bf3f8..95028de059d851a081b2ba8ab75f5dd29f0cbc2e 100644 (file)
@@ -95,7 +95,6 @@
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT2
-#define CONFIG_CMD_EMMC
 #define CONFIG_CMD_SOURCE
 #define CONFIG_CMD_I2C
 
index 63279b01ce2133e3df4bdf7c08bbefe7309b74b4..2556e3b3ef39601a9a9ae6b5d072471483115204 100644 (file)
@@ -78,7 +78,6 @@
 #define CONFIG_CMD_ELF
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_IRQ
-#define CONFIG_CMD_LOG
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_NFS
index 08924cce3cf0b520d64f922dcb61953c9fa9f58a..e09c16a6e3fe1e10ca539a6bee5cbba6cf304546 100644 (file)
 struct MD5Context {
        __u32 buf[4];
        __u32 bits[2];
-       unsigned char in[64];
+       union {
+               unsigned char in[64];
+               __u32 in32[16];
+       };
 };
 
 /*
index 81a09e3f904f3226f52c704b63bd7dc6aa28f3f1..2ae4a06319c4828c9210d79bb031a129a974684f 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -153,8 +153,8 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
        byteReverse(ctx->in, 14);
 
        /* Append length in bits and transform */
-       ((__u32 *) ctx->in)[14] = ctx->bits[0];
-       ((__u32 *) ctx->in)[15] = ctx->bits[1];
+       ctx->in32[14] = ctx->bits[0];
+       ctx->in32[15] = ctx->bits[1];
 
        MD5Transform(ctx->buf, (__u32 *) ctx->in);
        byteReverse((unsigned char *) ctx->buf, 4);
index 587c97fc887c9cda5bb0797479405cca4b34ad4d..7ba9e804d5f861527d50b0011ea4f93c91c4b058 100644 (file)
@@ -93,17 +93,17 @@ How to run it
 
 First do a dry run:
 
-$ ./tools/scripts/patman/patman -n
+$ ./tools/patman/patman -n
 
 If it can't detect the upstream branch, try telling it how many patches
 there are in your series:
 
-$ ./tools/scripts/patman/patman -n -c5
+$ ./tools/patman/patman -n -c5
 
 This will create patch files in your current directory and tell you who
 it is thinking of sending them to. Take a look at the patch files.
 
-$ ./tools/scripts/patman/patman -n -c5 -s1
+$ ./tools/patman/patman -n -c5 -s1
 
 Similar to the above, but skip the first commit and take the next 5. This
 is useful if your top commit is for setting up testing.
@@ -197,7 +197,7 @@ patch series and see how the patches turn out.
 Where Patches Are Sent
 ======================
 
-Once the patches are created, patman sends them using gti send-email. The
+Once the patches are created, patman sends them using git send-email. The
 whole series is sent to the recipients in Series-to: and Series-cc.
 You can Cc individual patches to other people with the Cc: tag. Tags in the
 subject are also picked up to Cc patches. For example, a commit like this: