Re: [U-Boot] [PATCH 1/2] TI: netdev: add driver for cpsw ethernet device

2010-09-01 Thread Cyril Chemparathy
Hi Ben,

I seem to have missed a comment while responding earlier:

[...]
 +int cpsw_register(struct cpsw_platform_data *data)
 Please redo things so that this function takes generic arguments.  Build
 up your struct internally.

Could you elaborate on the generic arguments here?  Are you referring to
the eth_device struct and bd_t args?

Regards
Cyril.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] TI: netdev: add driver for cpsw ethernet device

2010-08-31 Thread Cyril Chemparathy
Hi Ben,

[...]
 +COBJS-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
 Please don't use the word DRIVER here.  If possible, use something more
 verbose than CPSW too.

Will TI_CPSW_SWITCH work better considering that CPSW is the name of
the hardware block?

[...]
 +++ b/drivers/net/cpsw.c
 Please rename this ti_cpsw.c
Agreed.

[...]
 +struct cpsw_priv {
 + struct eth_device   *dev;
 + struct cpsw_platform_data   data;
 + int host_port;
 +
 + struct cpsw_regs*regs;
 + void*dma_regs;
 + struct cpsw_host_regs   *host_port_regs;
 + void*ale_regs;
 +
 + struct cpdma_desc   descs[NUM_DESCS];
 + struct cpdma_desc   *desc_free;
 + struct cpdma_chan   rx_chan, tx_chan;
 +
 + struct cpsw_slave   *slaves;
 +#define for_each_slave(priv, func, arg...)   \
 + do {\
 + int idx;\
 + for (idx = 0; idx  (priv)-data.slaves; idx++) \
 + (func)((priv)-slaves + idx, ##arg);\
 + } while (0)
 +};
 +
 
 Can this stuff go in a header file?

This stuff is intended to be private within the driver.  I can split
this out into drivers/net/ti_cpsw.h.

[...]
 diff --git a/include/netdev.h b/include/netdev.h
 index 94eedfe..009e2f1 100644
 --- a/include/netdev.h
 +++ b/include/netdev.h
 @@ -180,4 +180,33 @@ struct mv88e61xx_config {
   int mv88e61xx_switch_initialize(struct mv88e61xx_config *swconfig);
   #endif /* CONFIG_MV88E61XX_SWITCH */

 +#ifdef CONFIG_DRIVER_TI_CPSW
 +
 +struct cpsw_slave_data {
 + u32 slave_reg_ofs;
 + u32 sliver_reg_ofs;
 + int phy_id;
 +};
 +
 +struct cpsw_platform_data {
 + u32 mdio_base;
 + u32 cpsw_base;
 + int mdio_div;
 + int channels;   /* number of cpdma channels (symmetric) */
 + u32 cpdma_reg_ofs;  /* cpdma register offset*/
 + int slaves; /* number of slave cpgmac ports */
 + u32 ale_reg_ofs;/* address lookup engine reg offset */
 + int ale_entries;/* ale table size   */
 + u32 host_port_reg_ofs;  /* cpdma host port registers*/
 + u32 hw_stats_reg_ofs;   /* cpsw hw stats counters   */
 + u32 mac_control;
 + struct cpsw_slave_data  *slave_data;
 + void(*control)(int enabled);
 + void(*phy_init)(char *name, int addr);
 +};
 +
 This stuff doesn't belong in this file.  Definitions specific to your
 driver should go in /include/net/ti_cpsw.h (note that you'll be creating
 this directory, but that's where we want driver headers to go moving
 forward.  Also, please call the initialize function
 'ti_cpsw_initialize()'.  Despite what the readme file recommends, you're
 initializing something, not registering it.  If anything, the 'init()'
 functions are misnamed, but that's another discussion.

Will do.

We will post an updated v2 series shortly, with these changes.

Thanks
Cyril.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/2] tnetv107x cpsw ethernet switch driver

2010-08-03 Thread Cyril Chemparathy
This patch series adds support for the cpsw ethernet switch found on tnetv107x
and other SoCs from Texas Instruments.

Cyril Chemparathy (2):
  TI: netdev: add driver for cpsw ethernet device
  TI: add tnetv107x evm board support for cpsw

 board/ti/tnetv107xevm/sdb_board.c |  155 +++
 drivers/net/Makefile  |1 +
 drivers/net/cpsw.c|  840 +
 include/configs/tnetv107x_evm.h   |   16 +
 include/netdev.h  |   29 ++
 5 files changed, 1041 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/cpsw.c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] TI: add tnetv107x evm board support for cpsw

2010-08-03 Thread Cyril Chemparathy
This patch adds the necessary board-level hookups to get the CPSW device
working on tnetv107x evm boards.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
 board/ti/tnetv107xevm/sdb_board.c |  155 +
 include/configs/tnetv107x_evm.h   |   16 
 2 files changed, 171 insertions(+), 0 deletions(-)

diff --git a/board/ti/tnetv107xevm/sdb_board.c 
b/board/ti/tnetv107xevm/sdb_board.c
index 3ed1cfd..a7effd0 100644
--- a/board/ti/tnetv107xevm/sdb_board.c
+++ b/board/ti/tnetv107xevm/sdb_board.c
@@ -21,6 +21,7 @@
 
 #include common.h
 #include miiphy.h
+#include netdev.h
 #include linux/mtd/nand.h
 #include asm/arch/hardware.h
 #include asm/arch/clock.h
@@ -139,6 +140,160 @@ int dram_init(void)
return 0;
 }
 
+#ifdef CONFIG_DRIVER_TI_CPSW
+
+#define PHY_PAGE   22
+#define PHY_MSCR   21
+#define PHY_CSCR   16
+#define PHY_PAGE_MSCR  2
+#define PHY_PAGE_DEFAULT   0
+
+static void phy_init(char *name, int addr)
+{
+   unsigned short reg;
+
+   /* Program RXID and TXID */
+   if (miiphy_write(name, addr, PHY_PAGE, PHY_PAGE_MSCR) != 0) {
+   printf(failed to select mscr page\n);
+   return;
+   }
+
+   if (miiphy_read(name, addr, PHY_MSCR, reg) != 0) {
+   printf(failed to read mscr\n);
+   return;
+   }
+
+   reg |= 0x3  4;/* RXID and TXID */
+
+   if (miiphy_write(name, addr, PHY_MSCR, reg) != 0) {
+   printf(failed to write mscr\n);
+   return;
+   }
+
+   /* Program AutoCross */
+   if (miiphy_write(name, addr, PHY_PAGE, PHY_PAGE_DEFAULT) != 0) {
+   printf(failed to select cscr page\n);
+   return;
+   }
+
+   reg = 0x0060;
+   if (miiphy_write(name, addr, PHY_CSCR, reg) != 0) {
+   printf(failed to write cscr\n);
+   return;
+   }
+
+   /* Enable Autonegotiation */
+   if (miiphy_read(name, addr, PHY_BMCR, reg) != 0) {
+   printf(failed to read bmcr\n);
+   return;
+   }
+
+   reg |= PHY_BMCR_AUTON;
+
+   if (miiphy_write(name, addr, PHY_BMCR, reg) != 0) {
+   printf(failed to write bmcr\n);
+   return;
+   }
+
+   /* Setup Advertisement */
+   if (miiphy_read(name, addr, PHY_ANAR, reg) != 0) {
+   printf(failed to read anar\n);
+   return;
+   }
+
+   reg |= (0x1f  5);
+
+   if (miiphy_write(name, addr, PHY_ANAR, reg) != 0) {
+   printf(failed to write anar\n);
+   return;
+   }
+
+   /* PHY Soft Reset */
+   if (miiphy_reset(name, addr) != 0) {
+   printf(failed to soft-reset phy\n);
+   return;
+   }
+}
+
+static void cpsw_control(int enabled)
+{
+   u32 vtp0_regs   = TNETV107X_VTP_CNTRL_0;
+   u32 vtp1_regs   = TNETV107X_VTP_CNTRL_1;
+
+
+   if (!enabled) {
+   clk_disable(TNETV107X_LPSC_ETHSS_RGMII);
+   clk_disable(TNETV107X_LPSC_ETHSS);
+   return;
+   }
+
+   clk_enable(TNETV107X_LPSC_ETHSS);
+   clk_enable(TNETV107X_LPSC_ETHSS_RGMII);
+
+   /*
+* This piece of hardware is horribly mangled.  For one, port
+* 0 and port 1 configurations are strangely mixed up in the
+* register space, i.e., writing to port 0 registers affects
+* port 1 as well.   Second, for some other equally mysterious
+* reason, port 1 MUST be configured before port 0.
+*/
+   __raw_writel(0x, vtp1_regs + 0x04); /* single mode  */
+   __raw_writel(0x000f, vtp1_regs + 0x10); /* slew slowest */
+   __raw_writel(0x0002, vtp1_regs + 0x14); /* start*/
+
+   __raw_writel(0x, vtp0_regs + 0x04); /* single mode  */
+   __raw_writel(0x000f, vtp0_regs + 0x10); /* slew slowest */
+   __raw_writel(0x0002, vtp0_regs + 0x14); /* start*/
+}
+
+static struct cpsw_slave_data cpsw_slaves[] = {
+   {
+   .slave_reg_ofs  = 0x14,
+   .sliver_reg_ofs = 0x80,
+   .phy_id = 0,
+   },
+   {
+   .slave_reg_ofs  = 0x34,
+   .sliver_reg_ofs = 0xc0,
+   .phy_id = 1,
+   },
+};
+
+static struct cpsw_platform_data cpsw_data = {
+   .mdio_base  = TNETV107X_MDIO_BASE,
+   .cpsw_base  = TNETV107X_CPSW_BASE,
+   .mdio_div   = 0xff,
+   .channels   = 8,
+   .cpdma_reg_ofs  = 0x100,
+   .slaves = 2,
+   .slave_data = cpsw_slaves,
+   .ale_reg_ofs= 0x500,
+   .ale_entries= 1024,
+   .host_port_reg_ofs  = 0x54,
+   .hw_stats_reg_ofs   = 0x400,
+   .mac_control= (1  18) | /* IFCTLA */
+ (1  15) | /* EXTEN

[U-Boot] [PATCH 1/2] TI: netdev: add driver for cpsw ethernet device

2010-08-03 Thread Cyril Chemparathy
CPSW is an on-chip ethernet switch that is found on various SoCs from Texas
Instruments.  This patch adds a simple driver (based on the Linux driver) for
this hardware module.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
 drivers/net/Makefile |1 +
 drivers/net/cpsw.c   |  861 ++
 include/netdev.h |   29 ++
 3 files changed, 891 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/cpsw.c

diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 218eeff..f4f1ed2 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -73,6 +73,7 @@ COBJS-$(CONFIG_SMC9) += smc9.o
 COBJS-$(CONFIG_SMC911X) += smc911x.o
 COBJS-$(CONFIG_TIGON3) += tigon3.o bcm570x_autoneg.o 5701rls.o
 COBJS-$(CONFIG_DRIVER_TI_EMAC) += davinci_emac.o
+COBJS-$(CONFIG_DRIVER_TI_CPSW) += cpsw.o
 COBJS-$(CONFIG_TSEC_ENET) += tsec.o
 COBJS-$(CONFIG_TSI108_ETH) += tsi108_eth.o
 COBJS-$(CONFIG_ULI526X) += uli526x.o
diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c
new file mode 100644
index 000..c84ec78
--- /dev/null
+++ b/drivers/net/cpsw.c
@@ -0,0 +1,861 @@
+/*
+ * CPSW Ethernet Switch Driver
+ *
+ * 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 command.h
+#include net.h
+#include miiphy.h
+#include malloc.h
+#include net.h
+#include netdev.h
+#include asm/errno.h
+#include asm/io.h
+
+#define BIT(x) (1  (x))
+#define BITMASK(bits)  (BIT(bits) - 1)
+#define PHY_REG_MASK   0x1f
+#define PHY_ID_MASK0x1f
+#define NUM_DESCS  (PKTBUFSRX * 2)
+#define PKT_MIN60
+#define PKT_MAX(1500 + 14 + 4 + 4)
+
+/* DMA Registers */
+#define CPDMA_TXCONTROL0x004
+#define CPDMA_RXCONTROL0x014
+#define CPDMA_SOFTRESET0x01c
+#define CPDMA_RXFREE   0x0e0
+#define CPDMA_TXHDP0x100
+#define CPDMA_RXHDP0x120
+#define CPDMA_TXCP 0x140
+#define CPDMA_RXCP 0x160
+
+/* Descriptor mode bits */
+#define CPDMA_DESC_SOP BIT(31)
+#define CPDMA_DESC_EOP BIT(30)
+#define CPDMA_DESC_OWNER   BIT(29)
+#define CPDMA_DESC_EOQ BIT(28)
+
+struct cpsw_mdio_regs {
+   u32 version;
+   u32 control;
+#define CONTROL_IDLE   (1  31)
+#define CONTROL_ENABLE (1  30)
+
+   u32 alive;
+   u32 link;
+   u32 linkintraw;
+   u32 linkintmasked;
+   u32 __reserved_0[2];
+   u32 userintraw;
+   u32 userintmasked;
+   u32 userintmaskset;
+   u32 userintmaskclr;
+   u32 __reserved_1[20];
+
+   struct {
+   u32 access;
+   u32 physel;
+#define USERACCESS_GO  (1  31)
+#define USERACCESS_WRITE   (1  30)
+#define USERACCESS_ACK (1  29)
+#define USERACCESS_READ(0)
+#define USERACCESS_DATA(0x)
+   } user[0];
+};
+
+struct cpsw_regs {
+   u32 id_ver;
+   u32 control;
+   u32 soft_reset;
+   u32 stat_port_en;
+   u32 ptype;
+};
+
+struct cpsw_slave_regs {
+   u32 max_blks;
+   u32 blk_cnt;
+   u32 flow_thresh;
+   u32 port_vlan;
+   u32 tx_pri_map;
+   u32 gap_thresh;
+   u32 sa_lo;
+   u32 sa_hi;
+};
+
+struct cpsw_host_regs {
+   u32 max_blks;
+   u32 blk_cnt;
+   u32 flow_thresh;
+   u32 port_vlan;
+   u32 tx_pri_map;
+   u32 cpdma_tx_pri_map;
+   u32 cpdma_rx_chan_map;
+};
+
+struct cpsw_sliver_regs {
+   u32 id_ver;
+   u32 mac_control;
+   u32 mac_status;
+   u32 soft_reset;
+   u32 rx_maxlen;
+   u32 __reserved_0;
+   u32 rx_pause;
+   u32 tx_pause;
+   u32 __reserved_1;
+   u32 rx_pri_map;
+};
+
+#define ALE_ENTRY_BITS 68
+#define ALE_ENTRY_WORDSDIV_ROUND_UP(ALE_ENTRY_BITS, 32)
+
+/* ALE Registers */
+#define ALE_CONTROL0x08
+#define ALE_UNKNOWNVLAN0x18
+#define ALE_TABLE_CONTROL  0x20
+#define ALE_TABLE

[U-Boot] [PATCH v6 0/3] TI: tnetv107x patch series

2010-05-03 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch series generalizes current
ARM1176 code to allow for the addition of new ARM1176 SOCs.  The remaining
patches in this series add arch and board support.

Cyril Chemparathy (3):
  ARM1176: Coexist with other ARM1176 platforms
  ARM1176: TI: TNETV107X soc initial support
  TI: TNETV107X EVM initial support

 MAINTAINERS |4 +
 MAKEALL |1 +
 Makefile|3 +
 arch/arm/cpu/arm1176/cpu.c  |3 -
 arch/arm/cpu/arm1176/start.S|   65 +++-
 arch/arm/cpu/arm1176/tnetv107x/Makefile |   44 +++
 arch/arm/cpu/arm1176/tnetv107x/aemif.c  |   93 +
 arch/arm/cpu/arm1176/tnetv107x/clock.c  |  451 +++
 arch/arm/cpu/arm1176/tnetv107x/init.c   |   37 ++
 arch/arm/cpu/arm1176/tnetv107x/lowlevel_init.S  |   25 ++
 arch/arm/cpu/arm1176/tnetv107x/mux.c|  334 +
 arch/arm/cpu/arm1176/tnetv107x/timer.c  |  122 ++
 arch/arm/cpu/arm1176/tnetv107x/wdt.c|  180 +
 arch/arm/include/asm/arch-tnetv107x/clock.h |   68 
 arch/arm/include/asm/arch-tnetv107x/emif_defs.h |1 +
 arch/arm/include/asm/arch-tnetv107x/hardware.h  |  173 +
 arch/arm/include/asm/arch-tnetv107x/mux.h   |  306 +++
 arch/arm/include/asm/arch-tnetv107x/nand_defs.h |   38 ++
 board/ti/tnetv107xevm/Makefile  |   49 +++
 board/ti/tnetv107xevm/config.mk |   20 +
 board/ti/tnetv107xevm/sdb_board.c   |  149 
 include/configs/smdk6400.h  |8 +-
 include/configs/tnetv107x_evm.h |  153 
 23 files changed, 2304 insertions(+), 23 deletions(-)
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/Makefile
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/aemif.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/clock.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/init.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/lowlevel_init.S
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/mux.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/timer.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/wdt.c
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/clock.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/emif_defs.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/hardware.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/mux.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/nand_defs.h
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 include/configs/tnetv107x_evm.h

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v6 1/3] ARM1176: Coexist with other ARM1176 platforms

2010-05-03 Thread Cyril Chemparathy
The current ARM1176 CPU specific code is too specific to the SMDK6400
architecture.  The following changes were necessary prerequisites for the
addition of other SoCs based on ARM1176.

Existing board's (SMDK6400) configuration has been modified to keep behavior
unchanged despite these changes.

1. Peripheral port remap configurability
The earlier code had hardcoded remap values specific to s3c64xx in start.S.
This change makes the peripheral port remap addresses and sizes configurable.

2. U-Boot code relocation support
Most architectures allow u-boot code to run initially at a different
address (possibly in NOR) and then get relocated to its final resting place
in RAM.  Added support for this capability in ARM1176 architecture.

3. Disable TCM if necessary
If a ROM based bootloader happened to have initialized TCM, we disable it here
to keep things sane.

4. Remove unnecessary SoC specific includes
ARM1176 code does not really need this SoC specific include.  The presence
of this include prevents builds on other ARM1176 archs.

5. Modified virt-to-phys conversion during MMU disable
The original MMU disable code masks out too many bits from the load address
when it tries to figure out the physical address of the jump target label.
Consequently, it ends up branching to the wrong address after disabling the
MMU.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v6: remove CONFIG_SKIP_LOWLEVEL_INIT support
v6: modified virt-to-phys mapping to use offset instead of mask
v6: changed code comments
v6: removed undef CONFIG_SKIP_RELOCATE_UBOOT from smdk6400 config
v5: rebased on master in u-boot-arm.git
v4: rebased on next in u-boot-arm.git
v3: unchanged from v2
v2: unchanged from v1

 arch/arm/cpu/arm1176/cpu.c   |3 --
 arch/arm/cpu/arm1176/start.S |   65 ++---
 include/configs/smdk6400.h   |8 -
 3 files changed, 53 insertions(+), 23 deletions(-)

diff --git a/arch/arm/cpu/arm1176/cpu.c b/arch/arm/cpu/arm1176/cpu.c
index befa0cd..c0fd114 100644
--- a/arch/arm/cpu/arm1176/cpu.c
+++ b/arch/arm/cpu/arm1176/cpu.c
@@ -33,9 +33,6 @@
 
 #include common.h
 #include command.h
-#ifdef CONFIG_S3C64XX
-#include asm/arch/s3c6400.h
-#endif
 #include asm/system.h
 
 static void cache_flush (void);
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index e2b6c9b..a540edb 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -1,5 +1,5 @@
 /*
- *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *  armboot - Startup Code for ARM1176 CPU-core
  *
  * Copyright (c) 2007  Samsung Electronics
  *
@@ -35,9 +35,6 @@
 #ifdef CONFIG_ENABLE_MMU
 #include asm/proc/domain.h
 #endif
-#ifdef CONFIG_S3C64XX
-#include asm/arch/s3c6400.h
-#endif
 
 #if !defined(CONFIG_ENABLE_MMU)  !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE  CONFIG_SYS_UBOOT_BASE
@@ -172,14 +169,10 @@ cpu_init_crit:
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
+
/* Prepare to disable the MMU */
-   adr r1, mmu_disable_phys
-   /* We presume we're within the first 1024 bytes */
-   and r1, r1, #0x3fc
-   ldr r2, _TEXT_PHY_BASE
-   ldr r3, =0xfff0
-   and r2, r2, r3
-   orr r2, r2, r1
+   adr r2, mmu_disable_phys
+   sub r2, r2, #(CONFIG_SYS_PHY_UBOOT_BASE - TEXT_BASE)
b   mmu_disable
 
.align 5
@@ -189,14 +182,30 @@ mmu_disable:
nop
nop
mov pc, r2
+mmu_disable_phys:
+
+#ifdef CONFIG_DISABLE_TCM
+   /*
+* Disable the TCMs
+*/
+   mrc p15, 0, r0, c0, c0, 2   /* Return TCM details */
+   cmp r0, #0
+   beq skip_tcmdisable
+   mov r1, #0
+   mov r2, #1
+   tst r0, r2
+   mcrne   p15, 0, r1, c9, c1, 1   /* Disable Instruction TCM if present*/
+   tst r0, r2, LSL #16
+   mcrne   p15, 0, r1, c9, c1, 0   /* Disable Data TCM if present*/
+skip_tcmdisable:
+#endif
 #endif
 
-mmu_disable_phys:
-#ifdef CONFIG_S3C64XX
+#ifdef CONFIG_PERIPORT_REMAP
/* Peri port setup */
-   ldr r0, =0x7000
-   orr r0, r0, #0x13
-   mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)
+   ldr r0, =CONFIG_PERIPORT_BASE
+   orr r0, r0, #CONFIG_PERIPORT_SIZE
+   mcr p15,0,r0,c15,c2,4
 #endif
 
/*
@@ -204,7 +213,25 @@ mmu_disable_phys:
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
 
-after_copy:
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+relocate:  /* relocate U-Boot to RAM   */
+   adr r0, _start  /* r0 - current position of code   */
+   ldr r1, _TEXT_BASE  /* test if we run from flash or RAM */
+   cmp r0, r1  /* don't

[U-Boot] [PATCH v6 3/3] TI: TNETV107X EVM initial support

2010-05-03 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch adds support for the
TNETV107X EVM board.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v6: moved async emif config, and pll config to board code
v6: moved pll and aemif initialization to board init
v6: enabled NAND BBT and JFFS2 support
v5: rebased on master in u-boot-arm.git (unchanged)
v4: rebased on next in u-boot-arm.git (unchanged)
v3: Added NAND MTDID comment in board config
v2: Added maintainers entry
v2: Fixed sort order in main makefile
v2: Remove board specific linker script
v2: Style fixes - multiline comments
v2: Replaced clk_get() with clk_get_rate()

 MAINTAINERS   |4 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/ti/tnetv107xevm/Makefile|   49 
 board/ti/tnetv107xevm/config.mk   |   20 +
 board/ti/tnetv107xevm/sdb_board.c |  149 
 include/configs/tnetv107x_evm.h   |  153 +
 7 files changed, 379 insertions(+), 0 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 include/configs/tnetv107x_evm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index f3f59f4..2b03a1b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,6 +62,10 @@ Oliver Brown obr...@adventnetworks.com
 
gw8260  MPC8260
 
+Cyril Chemparathy cy...@ti.com
+
+   tnetv107x_evm   tnetv107x
+
 Conn Clark cl...@esteem.com
 
ESTEEM192E  MPC8xx
diff --git a/MAKEALL b/MAKEALL
index 593203f..ee3de7e 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -626,6 +626,7 @@ LIST_ARM11=\
mx31pdk_nand\
qong\
smdk6400\
+   tnetv107x_evm   \
 
 
 #
diff --git a/Makefile b/Makefile
index 0467147..052d0f1 100644
--- a/Makefile
+++ b/Makefile
@@ -3322,6 +3322,9 @@ smdk6400_config   :   unconfig
fi
@echo CONFIG_NAND_U_BOOT = y  $(obj)include/config.mk
 
+tnetv107x_evm_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm1176 tnetv107xevm ti tnetv107x
+
 #
 # i386
 #
diff --git a/board/ti/tnetv107xevm/Makefile b/board/ti/tnetv107xevm/Makefile
new file mode 100644
index 000..2446c2a
--- /dev/null
+++ b/board/ti/tnetv107xevm/Makefile
@@ -0,0 +1,49 @@
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  += sdb_board.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+.PHONY: all
+
+all: $(LIB)
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak *~ .depend
+
+#
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/ti/tnetv107xevm/config.mk b/board/ti/tnetv107xevm/config.mk
new file mode 100644
index 000..d24d49a
--- /dev/null
+++ b/board/ti/tnetv107xevm/config.mk
@@ -0,0 +1,20 @@
+#
+# 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

Re: [U-Boot] [PATCH v5 2/3] ARM1176: TI: TNETV107X soc initial support

2010-05-02 Thread Cyril Chemparathy
Hi Tom,

Thanks for the excellent review.

[...]
 +static struct async_emif_config default_async_emif_config[NUM_CS] = {
 + {   /* CS0 */
 + .mode   = ASYNC_EMIF_MODE_NAND,
 + .select_strobe  = ASYNC_EMIF_CS0_SELECT_STROBE,
 + .extend_wait= ASYNC_EMIF_CS0_EXTEND_WAIT,
 + .wr_setup   = ASYNC_EMIF_CS0_WR_SETUP,
 + .wr_strobe  = ASYNC_EMIF_CS0_WR_STROBE,
 + .wr_hold= ASYNC_EMIF_CS0_WR_HOLD,
 + .rd_setup   = ASYNC_EMIF_CS0_RD_SETUP,
 + .rd_strobe  = ASYNC_EMIF_CS0_RD_STROBE,
 + .rd_hold= ASYNC_EMIF_CS0_RD_HOLD,
 + .turn_around= ASYNC_EMIF_CS0_TURN_AROUND,
 + .width  = ASYNC_EMIF_CS0_WIDTH,
 + },
[...]

 A better place for all the preceding code would be in an arch *.h
 The NUM_CS should likely be a CONFIG_ paramter.

I have moved this over to board code instead, since the board should
determine these based on the connected device's timings.

[...]
 +static const struct pll_init_data plls[] = {
 + [SYS_PLL] = {
 + .config_enable  = CONFIG_PLL_SYS_CONFIG,
 + .pll= SYS_PLL,
 + .internal_osc   = CONFIG_PLL_SYS_INT_OSC,
 + .external_freq  = CONFIG_PLL_SYS_EXT_FREQ,
 +#if (CONFIG_PLL_SYS_CONFIG)
 + .pll_freq   = CONFIG_PLL_SYS_PLL_FREQ,
 + .div_freq = {
 + CONFIG_PLL_SYS_ARM1176_CLK,
 + CONFIG_PLL_SYS_DSP_CLK,
 + CONFIG_PLL_SYS_DDR_CLK,
 + CONFIG_PLL_SYS_FULL_CLK,
 + CONFIG_PLL_SYS_LCD_CLK,
 + CONFIG_PLL_SYS_VLYNQ_REF_CLK,
 + CONFIG_PLL_SYS_TSC_CLK,
 + CONFIG_PLL_SYS_HALF_CLK,
 + },
 +#endif
 + },
[...]

 Similar to above, the preceeding code is better placed in an arch *.h
 Please move.

Again, moved these initializations to board code instead.  Some boards
may opt to run at different rates.

[...]
 +static const struct pin_config pin_table[] = {
 + TNETV107X_MUX_CFG(0, 0, MUX_MODE_1),
 + TNETV107X_MUX_CFG(0, 0, MUX_MODE_2),
 
 Change these immedates '0, 0' into #defines
 Apply globally

These are register indices and bit shifts, not really amenable to macro
definition.  I have put in a comment for the column contents.

Regards
Cyril.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] ARM1176: Coexist with other ARM1176 platforms

2010-04-30 Thread Cyril Chemparathy
Hi Tom,

[...]
 +#ifndef CONFIG_SKIP_LOWLEVEL_INIT
 
 CONFIG_SKIP_LOWLEVEL_INIT is not used in the other patches.
 Why is this needed ?
 board/samsung/samsung/smdk6400 has a lowlevel_init.o function.
 It is confusing why this function is being if-def and not the real
 lowlevel_init..

Will remove.

 +#ifdef CONFIG_ENABLE_MMU
 
 This logic is may not be quite correct
  From include/configs/smdk6400.h
 #if !defined(CONFIG_NAND_SPL)  (TEXT_BASE = 0xc000)
 #define CONFIG_ENABLE_MMU
 #endif
 Please check

Thanks.  This logic was broken.

I have reworked this logic as follows, and removed the ifdef:

-   adr r1, mmu_disable_phys
-   /* We presume we're within the first 1024 bytes */
-   and r1, r1, #0x3fc
-   ldr r2, _TEXT_PHY_BASE
-   ldr r3, =0xfff0
-   and r2, r2, r3
-   orr r2, r2, r1
+   adr r2, mmu_disable_phys
+   sub r2, r2, #(CONFIG_SYS_PHY_UBOOT_BASE - TEXT_BASE)

The earlier implementation was masking out too many bits in trying to
convert the jump address from virtual to physical.  Any comments on this
change?

[...]
  /* Prepare to disable the MMU */
  adr r1, mmu_disable_phys
  /* We presume we're within the first 1024 bytes */
 @@ -187,20 +189,60 @@ mmu_disable:
  nop
  nop
  mov pc, r2
 +mmu_disable_phys:
 +#else
 +mcr p15, 0, r0, c1, c0, 0
 
 Are the noop's above needed here?

I think the original author's intent was to entirely occupy one cache
line.  I don't know enough about the s3c64xx architecture to comment.

[...]
  mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)

 This comment '@ 256 .. ' is no longer valid.

Thanks. Will fix.

[...]
 -/* move to reserved a couple spots for abort stack */
 +/* reserved a couple spots for abort stack */
 
 The old comment makes more sense.
 Revert this.

Thanks. Will fix.

[...]
 +#define CONFIG_SKIP_RELOCATE_UBOOT
 
 There is logic later in this file to undef this value.
 This is likely an error.
 If it isn't, add a comment.

I have removed the subsequent undef and verified that the generated
disassembly of start.S remains the same (with the exception of the
address computation change above) for both usb and non-usb smdk6400 builds.


Thanks
Cyril.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v5 3/3] TI: TNETV107X EVM initial support

2010-04-19 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch adds support for the
TNETV107X EVM board.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v5: rebased on master in u-boot-arm.git (unchanged)
v4: rebased on next in u-boot-arm.git (unchanged)
v3: Added NAND MTDID comment in board config
v2: Added maintainers entry
v2: Fixed sort order in main makefile
v2: Remove board specific linker script
v2: Style fixes - multiline comments
v2: Replaced clk_get() with clk_get_rate()

 MAINTAINERS   |4 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/ti/tnetv107xevm/Makefile|   49 +
 board/ti/tnetv107xevm/config.mk   |   20 
 board/ti/tnetv107xevm/sdb_board.c |   66 +++
 include/configs/tnetv107x_evm.h   |  214 +
 7 files changed, 357 insertions(+), 0 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 include/configs/tnetv107x_evm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 0e759c9..44369fe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,6 +62,10 @@ Oliver Brown obr...@adventnetworks.com
 
gw8260  MPC8260
 
+Cyril Chemparathy cy...@ti.com
+
+   tnetv107x_evm   tnetv107x
+
 Conn Clark cl...@esteem.com
 
ESTEEM192E  MPC8xx
diff --git a/MAKEALL b/MAKEALL
index b15d407..e10fead 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -625,6 +625,7 @@ LIST_ARM11=\
mx31pdk_nand\
qong\
smdk6400\
+   tnetv107x_evm   \
 
 
 #
diff --git a/Makefile b/Makefile
index 8b4e0b9..92aa3be 100644
--- a/Makefile
+++ b/Makefile
@@ -3319,6 +3319,9 @@ smdk6400_config   :   unconfig
fi
@echo CONFIG_NAND_U_BOOT = y  $(obj)include/config.mk
 
+tnetv107x_evm_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm1176 tnetv107xevm ti tnetv107x
+
 #
 # i386
 #
diff --git a/board/ti/tnetv107xevm/Makefile b/board/ti/tnetv107xevm/Makefile
new file mode 100644
index 000..2446c2a
--- /dev/null
+++ b/board/ti/tnetv107xevm/Makefile
@@ -0,0 +1,49 @@
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  += sdb_board.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+.PHONY: all
+
+all: $(LIB)
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak *~ .depend
+
+#
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/ti/tnetv107xevm/config.mk b/board/ti/tnetv107xevm/config.mk
new file mode 100644
index 000..d24d49a
--- /dev/null
+++ b/board/ti/tnetv107xevm/config.mk
@@ -0,0 +1,20 @@
+#
+# 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

[U-Boot] [PATCH v5 0/3] TI: tnetv107x patch series

2010-04-19 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch series generalizes current
ARM1176 code to allow for the addition of new ARM1176 SOCs.  The remaining
patches in this series add arch and board support.

Cyril Chemparathy (3):
  ARM1176: Coexist with other ARM1176 platforms
  ARM1176: TI: TNETV107X soc initial support
  TI: TNETV107X EVM initial support

 MAINTAINERS |4 +
 MAKEALL |1 +
 Makefile|3 +
 arch/arm/cpu/arm1176/cpu.c  |3 -
 arch/arm/cpu/arm1176/start.S|   62 +++-
 arch/arm/cpu/arm1176/tnetv107x/Makefile |   44 ++
 arch/arm/cpu/arm1176/tnetv107x/aemif.c  |  151 +++
 arch/arm/cpu/arm1176/tnetv107x/clock.c  |  542 +++
 arch/arm/cpu/arm1176/tnetv107x/init.c   |   41 ++
 arch/arm/cpu/arm1176/tnetv107x/lowlevel_init.S  |   25 +
 arch/arm/cpu/arm1176/tnetv107x/mux.c|  463 +++
 arch/arm/cpu/arm1176/tnetv107x/timer.c  |  125 ++
 arch/arm/cpu/arm1176/tnetv107x/wdt.c|  172 +++
 arch/arm/include/asm/arch-tnetv107x/clock.h |   50 ++
 arch/arm/include/asm/arch-tnetv107x/emif_defs.h |1 +
 arch/arm/include/asm/arch-tnetv107x/hardware.h  |  184 
 arch/arm/include/asm/arch-tnetv107x/mux.h   |  307 +
 arch/arm/include/asm/arch-tnetv107x/nand_defs.h |   38 ++
 board/ti/tnetv107xevm/Makefile  |   49 ++
 board/ti/tnetv107xevm/config.mk |   20 +
 board/ti/tnetv107xevm/sdb_board.c   |   66 +++
 include/configs/smdk6400.h  |6 +
 include/configs/tnetv107x_evm.h |  214 +
 23 files changed, 2557 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/Makefile
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/aemif.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/clock.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/init.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/lowlevel_init.S
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/mux.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/timer.c
 create mode 100644 arch/arm/cpu/arm1176/tnetv107x/wdt.c
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/clock.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/emif_defs.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/hardware.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/mux.h
 create mode 100644 arch/arm/include/asm/arch-tnetv107x/nand_defs.h
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 include/configs/tnetv107x_evm.h

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v5 1/3] ARM1176: Coexist with other ARM1176 platforms

2010-04-19 Thread Cyril Chemparathy
The current ARM1176 CPU specific code is too specific to the SMDK6400
architecture.  The following changes were necessary prerequisites for the
addition of other SoCs based on ARM1176.

Existing board's (SMDK6400) configuration has been modified to keep behavior
unchanged despite these changes.

1. Peripheral port remap configurability
The earlier code had hardcoded remap values specific to s3c64xx in start.S.
This change makes the peripheral port remap addresses and sizes configurable.

2. Skip low level initialization
Ability to skip low level initialization if necessary.  Many other platforms
have a similar capability, and this is quite useful during debug/bring-up.

3. U-Boot code relocation support
Most architectures allow u-boot code to run initially at a different
address (possibly in NOR) and then get relocated to its final resting place
in RAM.  Added support for this capability in ARM1176 architecture.

4. Disable TCM if necessary
If a ROM based bootloader happened to have initialized TCM, we disable it here
to keep things sane.

5. Remove unnecessary SoC specific includes
ARM1176 code does not really need this SoC specific include.  The presence
of this include prevents builds on other ARM1176 archs.

6. ARM926 style MMU disable when !CONFIG_ENABLE_MMU
The original MMU disable code masks out too many bits from the load address
when it tries to figure out the physical address of the jump target label.
Consequently, it ends up branching to the wrong address after disabling the
MMU.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v5: rebased on master in u-boot-arm.git
v4: rebased on next in u-boot-arm.git
v3: unchanged from v2
v2: unchanged from v1

 arch/arm/cpu/arm1176/cpu.c   |3 --
 arch/arm/cpu/arm1176/start.S |   62 ++---
 include/configs/smdk6400.h   |6 
 3 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/arch/arm/cpu/arm1176/cpu.c b/arch/arm/cpu/arm1176/cpu.c
index befa0cd..c0fd114 100644
--- a/arch/arm/cpu/arm1176/cpu.c
+++ b/arch/arm/cpu/arm1176/cpu.c
@@ -33,9 +33,6 @@
 
 #include common.h
 #include command.h
-#ifdef CONFIG_S3C64XX
-#include asm/arch/s3c6400.h
-#endif
 #include asm/system.h
 
 static void cache_flush (void);
diff --git a/arch/arm/cpu/arm1176/start.S b/arch/arm/cpu/arm1176/start.S
index e2b6c9b..beec574 100644
--- a/arch/arm/cpu/arm1176/start.S
+++ b/arch/arm/cpu/arm1176/start.S
@@ -1,5 +1,5 @@
 /*
- *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *  armboot - Startup Code for ARM1176 CPU-core
  *
  * Copyright (c) 2007  Samsung Electronics
  *
@@ -35,9 +35,6 @@
 #ifdef CONFIG_ENABLE_MMU
 #include asm/proc/domain.h
 #endif
-#ifdef CONFIG_S3C64XX
-#include asm/arch/s3c6400.h
-#endif
 
 #if !defined(CONFIG_ENABLE_MMU)  !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE  CONFIG_SYS_UBOOT_BASE
@@ -147,6 +144,7 @@ reset:
  *
  *
  */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
/*
 * we do sys-critical inits only at reboot,
 * not when booting from ram!
@@ -172,6 +170,8 @@ cpu_init_crit:
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
+
+#ifdef CONFIG_ENABLE_MMU
/* Prepare to disable the MMU */
adr r1, mmu_disable_phys
/* We presume we're within the first 1024 bytes */
@@ -189,13 +189,32 @@ mmu_disable:
nop
nop
mov pc, r2
+mmu_disable_phys:
+#else
+   mcr p15, 0, r0, c1, c0, 0
 #endif
 
-mmu_disable_phys:
-#ifdef CONFIG_S3C64XX
+#ifdef CONFIG_DISABLE_TCM
+   /*
+* Disable the TCMs
+*/
+   mrc p15, 0, r0, c0, c0, 2   /* Return TCM details */
+   cmp r0, #0
+   beq skip_tcmdisable
+   mov r1, #0
+   mov r2, #1
+   tst r0, r2
+   mcrne   p15, 0, r1, c9, c1, 1   /* Disable Instruction TCM if present*/
+   tst r0, r2, LSL #16
+   mcrne   p15, 0, r1, c9, c1, 0   /* Disable Data TCM if present*/
+skip_tcmdisable:
+#endif
+#endif
+
+#ifdef CONFIG_PERIPORT_REMAP
/* Peri port setup */
-   ldr r0, =0x7000
-   orr r0, r0, #0x13
+   ldr r0, =CONFIG_PERIPORT_BASE
+   orr r0, r0, #CONFIG_PERIPORT_SIZE
mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)
 #endif
 
@@ -203,8 +222,27 @@ mmu_disable_phys:
 * Go setup Memory and board specific bits prior to relocation.
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+relocate:  /* relocate U-Boot to RAM   */
+   adr r0, _start  /* r0 - current position of code   */
+   ldr r1, _TEXT_BASE  /* test if we run from flash

[U-Boot] [PATCH v4 1/3] ARM1176: Coexist with other ARM1176 platforms

2010-04-12 Thread Cyril Chemparathy
The current ARM1176 CPU specific code is too specific to the SMDK6400
architecture.  The following changes were necessary prerequisites for the
addition of other SoCs based on ARM1176.

Existing board's (SMDK6400) configuration has been modified to keep behavior
unchanged despite these changes.

1. Peripheral port remap configurability
The earlier code had hardcoded remap values specific to s3c64xx in start.S.
This change makes the peripheral port remap addresses and sizes configurable.

2. Skip low level initialization
Ability to skip low level initialization if necessary.  Many other platforms
have a similar capability, and this is quite useful during debug/bring-up.

3. U-Boot code relocation support
Most architectures allow u-boot code to run initially at a different
address (possibly in NOR) and then get relocated to its final resting place
in RAM.  Added support for this capability in ARM1176 architecture.

4. Disable TCM if necessary
If a ROM based bootloader happened to have initialized TCM, we disable it here
to keep things sane.

5. Remove unnecessary SoC specific includes
ARM1176 code does not really need this SoC specific include.  The presence
of this include prevents builds on other ARM1176 archs.

6. ARM926 style MMU disable when !CONFIG_ENABLE_MMU
The original MMU disable code masks out too many bits from the load address
when it tries to figure out the physical address of the jump target label.
Consequently, it ends up branching to the wrong address after disabling the
MMU.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v4: rebased on next in u-boot-arm.git
v3: unchanged from v2
v2: unchanged from v1

 cpu/arm1176/cpu.c  |3 --
 cpu/arm1176/start.S|   62 
 include/configs/smdk6400.h |6 
 3 files changed, 57 insertions(+), 14 deletions(-)

diff --git a/cpu/arm1176/cpu.c b/cpu/arm1176/cpu.c
index befa0cd..c0fd114 100644
--- a/cpu/arm1176/cpu.c
+++ b/cpu/arm1176/cpu.c
@@ -33,9 +33,6 @@
 
 #include common.h
 #include command.h
-#ifdef CONFIG_S3C64XX
-#include asm/arch/s3c6400.h
-#endif
 #include asm/system.h
 
 static void cache_flush (void);
diff --git a/cpu/arm1176/start.S b/cpu/arm1176/start.S
index e2b6c9b..beec574 100644
--- a/cpu/arm1176/start.S
+++ b/cpu/arm1176/start.S
@@ -1,5 +1,5 @@
 /*
- *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *  armboot - Startup Code for ARM1176 CPU-core
  *
  * Copyright (c) 2007  Samsung Electronics
  *
@@ -35,9 +35,6 @@
 #ifdef CONFIG_ENABLE_MMU
 #include asm/proc/domain.h
 #endif
-#ifdef CONFIG_S3C64XX
-#include asm/arch/s3c6400.h
-#endif
 
 #if !defined(CONFIG_ENABLE_MMU)  !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE  CONFIG_SYS_UBOOT_BASE
@@ -147,6 +144,7 @@ reset:
  *
  *
  */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
/*
 * we do sys-critical inits only at reboot,
 * not when booting from ram!
@@ -172,6 +170,8 @@ cpu_init_crit:
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
+
+#ifdef CONFIG_ENABLE_MMU
/* Prepare to disable the MMU */
adr r1, mmu_disable_phys
/* We presume we're within the first 1024 bytes */
@@ -189,13 +189,32 @@ mmu_disable:
nop
nop
mov pc, r2
+mmu_disable_phys:
+#else
+   mcr p15, 0, r0, c1, c0, 0
 #endif
 
-mmu_disable_phys:
-#ifdef CONFIG_S3C64XX
+#ifdef CONFIG_DISABLE_TCM
+   /*
+* Disable the TCMs
+*/
+   mrc p15, 0, r0, c0, c0, 2   /* Return TCM details */
+   cmp r0, #0
+   beq skip_tcmdisable
+   mov r1, #0
+   mov r2, #1
+   tst r0, r2
+   mcrne   p15, 0, r1, c9, c1, 1   /* Disable Instruction TCM if present*/
+   tst r0, r2, LSL #16
+   mcrne   p15, 0, r1, c9, c1, 0   /* Disable Data TCM if present*/
+skip_tcmdisable:
+#endif
+#endif
+
+#ifdef CONFIG_PERIPORT_REMAP
/* Peri port setup */
-   ldr r0, =0x7000
-   orr r0, r0, #0x13
+   ldr r0, =CONFIG_PERIPORT_BASE
+   orr r0, r0, #CONFIG_PERIPORT_SIZE
mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)
 #endif
 
@@ -203,8 +222,27 @@ mmu_disable_phys:
 * Go setup Memory and board specific bits prior to relocation.
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+relocate:  /* relocate U-Boot to RAM   */
+   adr r0, _start  /* r0 - current position of code   */
+   ldr r1, _TEXT_BASE  /* test if we run from flash or RAM */
+   cmp r0, r1  /* don't reloc during debug */
+   beq stack_setup

[U-Boot] [PATCH v4 0/3] TI: tnetv107x patch series

2010-04-12 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch series generalizes current
ARM1176 code to allow for the addition of new ARM1176 SOCs.  The remaining
patches in this series add arch and board support.

The contents of this series are identical to the v2 patch series posted
earlier, with the exception of an added comment in tnetv107x_evm.h indicating
the reasoning behind reusing the davinci_nand MTDID.


Cyril Chemparathy (3):
  ARM1176: Coexist with other ARM1176 platforms
  ARM1176: TI: TNETV107X soc initial support
  TI: TNETV107X EVM initial support

 MAINTAINERS|4 +
 MAKEALL|1 +
 Makefile   |3 +
 board/ti/tnetv107xevm/Makefile |   49 +++
 board/ti/tnetv107xevm/config.mk|   20 +
 board/ti/tnetv107xevm/sdb_board.c  |   66 
 cpu/arm1176/cpu.c  |3 -
 cpu/arm1176/start.S|   62 +++-
 cpu/arm1176/tnetv107x/Makefile |   44 +++
 cpu/arm1176/tnetv107x/aemif.c  |  151 
 cpu/arm1176/tnetv107x/clock.c  |  542 
 cpu/arm1176/tnetv107x/init.c   |   41 ++
 cpu/arm1176/tnetv107x/lowlevel_init.S  |   25 ++
 cpu/arm1176/tnetv107x/mux.c|  463 
 cpu/arm1176/tnetv107x/timer.c  |  125 +++
 cpu/arm1176/tnetv107x/wdt.c|  172 +
 include/asm-arm/arch-tnetv107x/clock.h |   50 +++
 include/asm-arm/arch-tnetv107x/emif_defs.h |1 +
 include/asm-arm/arch-tnetv107x/hardware.h  |  184 ++
 include/asm-arm/arch-tnetv107x/mux.h   |  307 
 include/asm-arm/arch-tnetv107x/nand_defs.h |   38 ++
 include/configs/smdk6400.h |6 +
 include/configs/tnetv107x_evm.h|  214 +++
 23 files changed, 2557 insertions(+), 14 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 cpu/arm1176/tnetv107x/Makefile
 create mode 100644 cpu/arm1176/tnetv107x/aemif.c
 create mode 100644 cpu/arm1176/tnetv107x/clock.c
 create mode 100644 cpu/arm1176/tnetv107x/init.c
 create mode 100644 cpu/arm1176/tnetv107x/lowlevel_init.S
 create mode 100644 cpu/arm1176/tnetv107x/mux.c
 create mode 100644 cpu/arm1176/tnetv107x/timer.c
 create mode 100644 cpu/arm1176/tnetv107x/wdt.c
 create mode 100644 include/asm-arm/arch-tnetv107x/clock.h
 create mode 100644 include/asm-arm/arch-tnetv107x/emif_defs.h
 create mode 100644 include/asm-arm/arch-tnetv107x/hardware.h
 create mode 100644 include/asm-arm/arch-tnetv107x/mux.h
 create mode 100644 include/asm-arm/arch-tnetv107x/nand_defs.h
 create mode 100644 include/configs/tnetv107x_evm.h

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 3/3] TI: TNETV107X EVM initial support

2010-04-12 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch adds support for the
TNETV107X EVM board.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v4: rebased on next in u-boot-arm.git (unchanged)
v3: Added NAND MTDID comment in board config
v2: Added maintainers entry
v2: Fixed sort order in main makefile
v2: Remove board specific linker script
v2: Style fixes - multiline comments
v2: Replaced clk_get() with clk_get_rate()

 MAINTAINERS   |4 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/ti/tnetv107xevm/Makefile|   49 +
 board/ti/tnetv107xevm/config.mk   |   20 
 board/ti/tnetv107xevm/sdb_board.c |   66 +++
 include/configs/tnetv107x_evm.h   |  214 +
 7 files changed, 357 insertions(+), 0 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 include/configs/tnetv107x_evm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 0658bc3..37cf8b7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,6 +62,10 @@ Oliver Brown obr...@adventnetworks.com
 
gw8260  MPC8260
 
+Cyril Chemparathy cy...@ti.com
+
+   tnetv107x_evm   tnetv107x
+
 Conn Clark cl...@esteem.com
 
ESTEEM192E  MPC8xx
diff --git a/MAKEALL b/MAKEALL
index a88c31e..63d8d16 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -623,6 +623,7 @@ LIST_ARM11=\
mx31pdk_nand\
qong\
smdk6400\
+   tnetv107x_evm   \
 
 
 #
diff --git a/Makefile b/Makefile
index 4532550..d0ef39d 100644
--- a/Makefile
+++ b/Makefile
@@ -3313,6 +3313,9 @@ smdk6400_config   :   unconfig
fi
@echo CONFIG_NAND_U_BOOT = y  $(obj)include/config.mk
 
+tnetv107x_evm_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm1176 tnetv107xevm ti tnetv107x
+
 #
 # i386
 #
diff --git a/board/ti/tnetv107xevm/Makefile b/board/ti/tnetv107xevm/Makefile
new file mode 100644
index 000..2446c2a
--- /dev/null
+++ b/board/ti/tnetv107xevm/Makefile
@@ -0,0 +1,49 @@
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  += sdb_board.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+.PHONY: all
+
+all: $(LIB)
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak *~ .depend
+
+#
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/ti/tnetv107xevm/config.mk b/board/ti/tnetv107xevm/config.mk
new file mode 100644
index 000..d24d49a
--- /dev/null
+++ b/board/ti/tnetv107xevm/config.mk
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+TEXT_BASE = 0x83FC
diff --git a/board/ti

[U-Boot] [PATCH v3 0/3] TI: tnetv107x patch series

2010-04-06 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch series generalizes current
ARM1176 code to allow for the addition of new ARM1176 SOCs.  The remaining
patches in this series add arch and board support.

The contents of this series are identical to the v2 patch series posted
earlier, with the exception of an added comment in tnetv107x_evm.h indicating
the reasoning behind reusing the davinci_nand MTDID.


Cyril Chemparathy (3):
  ARM1176: Coexist with other ARM1176 platforms
  ARM1176: TI: TNETV107X soc initial support
  TI: TNETV107X EVM initial support

 MAINTAINERS|4 +
 MAKEALL|1 +
 Makefile   |3 +
 board/ti/tnetv107xevm/Makefile |   49 +++
 board/ti/tnetv107xevm/config.mk|   20 +
 board/ti/tnetv107xevm/sdb_board.c  |   66 
 cpu/arm1176/cpu.c  |1 -
 cpu/arm1176/start.S|   60 +++-
 cpu/arm1176/tnetv107x/Makefile |   44 +++
 cpu/arm1176/tnetv107x/aemif.c  |  151 
 cpu/arm1176/tnetv107x/clock.c  |  542 
 cpu/arm1176/tnetv107x/init.c   |   41 ++
 cpu/arm1176/tnetv107x/lowlevel_init.S  |   25 ++
 cpu/arm1176/tnetv107x/mux.c|  463 
 cpu/arm1176/tnetv107x/timer.c  |  125 +++
 cpu/arm1176/tnetv107x/wdt.c|  172 +
 include/asm-arm/arch-tnetv107x/clock.h |   50 +++
 include/asm-arm/arch-tnetv107x/emif_defs.h |1 +
 include/asm-arm/arch-tnetv107x/hardware.h  |  184 ++
 include/asm-arm/arch-tnetv107x/mux.h   |  307 
 include/asm-arm/arch-tnetv107x/nand_defs.h |   38 ++
 include/configs/smdk6400.h |6 +
 include/configs/tnetv107x_evm.h|  214 +++
 23 files changed, 2558 insertions(+), 9 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 cpu/arm1176/tnetv107x/Makefile
 create mode 100644 cpu/arm1176/tnetv107x/aemif.c
 create mode 100644 cpu/arm1176/tnetv107x/clock.c
 create mode 100644 cpu/arm1176/tnetv107x/init.c
 create mode 100644 cpu/arm1176/tnetv107x/lowlevel_init.S
 create mode 100644 cpu/arm1176/tnetv107x/mux.c
 create mode 100644 cpu/arm1176/tnetv107x/timer.c
 create mode 100644 cpu/arm1176/tnetv107x/wdt.c
 create mode 100644 include/asm-arm/arch-tnetv107x/clock.h
 create mode 100644 include/asm-arm/arch-tnetv107x/emif_defs.h
 create mode 100644 include/asm-arm/arch-tnetv107x/hardware.h
 create mode 100644 include/asm-arm/arch-tnetv107x/mux.h
 create mode 100644 include/asm-arm/arch-tnetv107x/nand_defs.h
 create mode 100644 include/configs/tnetv107x_evm.h

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 1/3] ARM1176: Coexist with other ARM1176 platforms

2010-04-06 Thread Cyril Chemparathy
The current ARM1176 CPU specific code is too specific to the SMDK6400
architecture.  The following changes were necessary prerequisites for the
addition of other SoCs based on ARM1176.

Existing board's (SMDK6400) configuration has been modified to keep behavior
unchanged despite these changes.

1. Peripheral port remap configurability
The earlier code had hardcoded remap values specific to s3c64xx in start.S.
This change makes the peripheral port remap addresses and sizes configurable.

2. Skip low level initialization
Ability to skip low level initialization if necessary.  Many other platforms
have a similar capability, and this is quite useful during debug/bring-up.

3. U-Boot code relocation support
Most architectures allow u-boot code to run initially at a different
address (possibly in NOR) and then get relocated to its final resting place
in RAM.  Added support for this capability in ARM1176 architecture.

4. Disable TCM if necessary
If a ROM based bootloader happened to have initialized TCM, we disable it here
to keep things sane.

5. Remove unnecessary SoC specific includes
ARM1176 code does not really need this SoC specific include.  The presence
of this include prevents builds on other ARM1176 archs.

6. ARM926 style MMU disable when !CONFIG_ENABLE_MMU
The original MMU disable code masks out too many bits from the load address
when it tries to figure out the physical address of the jump target label.
Consequently, it ends up branching to the wrong address after disabling the
MMU.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v3: unchanged from v2
v2: unchanged from v1

 cpu/arm1176/cpu.c  |1 -
 cpu/arm1176/start.S|   60 ++--
 include/configs/smdk6400.h |6 
 3 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/cpu/arm1176/cpu.c b/cpu/arm1176/cpu.c
index 2c0014f..c0fd114 100644
--- a/cpu/arm1176/cpu.c
+++ b/cpu/arm1176/cpu.c
@@ -33,7 +33,6 @@
 
 #include common.h
 #include command.h
-#include asm/arch/s3c6400.h
 #include asm/system.h
 
 static void cache_flush (void);
diff --git a/cpu/arm1176/start.S b/cpu/arm1176/start.S
index 68a356d..beec574 100644
--- a/cpu/arm1176/start.S
+++ b/cpu/arm1176/start.S
@@ -1,5 +1,5 @@
 /*
- *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *  armboot - Startup Code for ARM1176 CPU-core
  *
  * Copyright (c) 2007  Samsung Electronics
  *
@@ -35,7 +35,6 @@
 #ifdef CONFIG_ENABLE_MMU
 #include asm/proc/domain.h
 #endif
-#include asm/arch/s3c6400.h
 
 #if !defined(CONFIG_ENABLE_MMU)  !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE  CONFIG_SYS_UBOOT_BASE
@@ -145,6 +144,7 @@ reset:
  *
  *
  */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
/*
 * we do sys-critical inits only at reboot,
 * not when booting from ram!
@@ -170,6 +170,8 @@ cpu_init_crit:
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
+
+#ifdef CONFIG_ENABLE_MMU
/* Prepare to disable the MMU */
adr r1, mmu_disable_phys
/* We presume we're within the first 1024 bytes */
@@ -187,20 +189,60 @@ mmu_disable:
nop
nop
mov pc, r2
+mmu_disable_phys:
+#else
+   mcr p15, 0, r0, c1, c0, 0
 #endif
 
-mmu_disable_phys:
+#ifdef CONFIG_DISABLE_TCM
+   /*
+* Disable the TCMs
+*/
+   mrc p15, 0, r0, c0, c0, 2   /* Return TCM details */
+   cmp r0, #0
+   beq skip_tcmdisable
+   mov r1, #0
+   mov r2, #1
+   tst r0, r2
+   mcrne   p15, 0, r1, c9, c1, 1   /* Disable Instruction TCM if present*/
+   tst r0, r2, LSL #16
+   mcrne   p15, 0, r1, c9, c1, 0   /* Disable Data TCM if present*/
+skip_tcmdisable:
+#endif
+#endif
+
+#ifdef CONFIG_PERIPORT_REMAP
/* Peri port setup */
-   ldr r0, =0x7000
-   orr r0, r0, #0x13
+   ldr r0, =CONFIG_PERIPORT_BASE
+   orr r0, r0, #CONFIG_PERIPORT_SIZE
mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)
+#endif
 
/*
 * Go setup Memory and board specific bits prior to relocation.
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+relocate:  /* relocate U-Boot to RAM   */
+   adr r0, _start  /* r0 - current position of code   */
+   ldr r1, _TEXT_BASE  /* test if we run from flash or RAM */
+   cmp r0, r1  /* don't reloc during debug */
+   beq stack_setup
+
+   ldr r2, _armboot_start
+   ldr r3, _bss_start
+   sub r2, r3, r2  /* r2 - size of armboot

[U-Boot] [PATCH v3 3/3] TI: TNETV107X EVM initial support

2010-04-06 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch adds support for the
TNETV107X EVM board.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
v3: Added NAND MTDID comment in board config
v2: Added maintainers entry
v2: Fixed sort order in main makefile
v2: Remove board specific linker script
v2: Style fixes - multiline comments
v2: Replaced clk_get() with clk_get_rate()

 MAINTAINERS   |4 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/ti/tnetv107xevm/Makefile|   49 +
 board/ti/tnetv107xevm/config.mk   |   20 
 board/ti/tnetv107xevm/sdb_board.c |   66 +++
 include/configs/tnetv107x_evm.h   |  214 +
 7 files changed, 357 insertions(+), 0 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 include/configs/tnetv107x_evm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index bb03f17..daa074c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,6 +62,10 @@ Oliver Brown obr...@adventnetworks.com
 
gw8260  MPC8260
 
+Cyril Chemparathy cy...@ti.com
+
+   tnetv107x_evm   tnetv107x
+
 Conn Clark cl...@esteem.com
 
ESTEEM192E  MPC8xx
diff --git a/MAKEALL b/MAKEALL
index a88c31e..63d8d16 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -623,6 +623,7 @@ LIST_ARM11=\
mx31pdk_nand\
qong\
smdk6400\
+   tnetv107x_evm   \
 
 
 #
diff --git a/Makefile b/Makefile
index 4532550..d0ef39d 100644
--- a/Makefile
+++ b/Makefile
@@ -3313,6 +3313,9 @@ smdk6400_config   :   unconfig
fi
@echo CONFIG_NAND_U_BOOT = y  $(obj)include/config.mk
 
+tnetv107x_evm_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm1176 tnetv107xevm ti tnetv107x
+
 #
 # i386
 #
diff --git a/board/ti/tnetv107xevm/Makefile b/board/ti/tnetv107xevm/Makefile
new file mode 100644
index 000..2446c2a
--- /dev/null
+++ b/board/ti/tnetv107xevm/Makefile
@@ -0,0 +1,49 @@
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  += sdb_board.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+.PHONY: all
+
+all: $(LIB)
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak *~ .depend
+
+#
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/ti/tnetv107xevm/config.mk b/board/ti/tnetv107xevm/config.mk
new file mode 100644
index 000..d24d49a
--- /dev/null
+++ b/board/ti/tnetv107xevm/config.mk
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+TEXT_BASE = 0x83FC
diff --git a/board/ti/tnetv107xevm/sdb_board.c 
b/board/ti/tnetv107xevm

[U-Boot] [PATCH v2 1/3] ARM1176: Coexist with other ARM1176 platforms

2010-03-31 Thread Cyril Chemparathy
The current ARM1176 CPU specific code is too specific to the SMDK6400
architecture.  The following changes were necessary prerequisites for the
addition of other SoCs based on ARM1176.

Existing board's (SMDK6400) configuration has been modified to keep behavior
unchanged despite these changes.

1. Peripheral port remap configurability
The earlier code had hardcoded remap values specific to s3c64xx in start.S.
This change makes the peripheral port remap addresses and sizes configurable.

2. Skip low level initialization
Ability to skip low level initialization if necessary.  Many other platforms
have a similar capability, and this is quite useful during debug/bring-up.

3. U-Boot code relocation support
Most architectures allow u-boot code to run initially at a different
address (possibly in NOR) and then get relocated to its final resting place
in RAM.  Added support for this capability in ARM1176 architecture.

4. Disable TCM if necessary
If a ROM based bootloader happened to have initialized TCM, we disable it here
to keep things sane.

5. Remove unnecessary SoC specific includes
ARM1176 code does not really need this SoC specific include.  The presence
of this include prevents builds on other ARM1176 archs.

6. ARM926 style MMU disable when !CONFIG_ENABLE_MMU
The original MMU disable code masks out too many bits from the load address
when it tries to figure out the physical address of the jump target label.
Consequently, it ends up branching to the wrong address after disabling the
MMU.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
Unchanged from v1

 cpu/arm1176/cpu.c  |1 -
 cpu/arm1176/start.S|   60 ++--
 include/configs/smdk6400.h |6 
 3 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/cpu/arm1176/cpu.c b/cpu/arm1176/cpu.c
index 2c0014f..c0fd114 100644
--- a/cpu/arm1176/cpu.c
+++ b/cpu/arm1176/cpu.c
@@ -33,7 +33,6 @@
 
 #include common.h
 #include command.h
-#include asm/arch/s3c6400.h
 #include asm/system.h
 
 static void cache_flush (void);
diff --git a/cpu/arm1176/start.S b/cpu/arm1176/start.S
index 68a356d..beec574 100644
--- a/cpu/arm1176/start.S
+++ b/cpu/arm1176/start.S
@@ -1,5 +1,5 @@
 /*
- *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *  armboot - Startup Code for ARM1176 CPU-core
  *
  * Copyright (c) 2007  Samsung Electronics
  *
@@ -35,7 +35,6 @@
 #ifdef CONFIG_ENABLE_MMU
 #include asm/proc/domain.h
 #endif
-#include asm/arch/s3c6400.h
 
 #if !defined(CONFIG_ENABLE_MMU)  !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE  CONFIG_SYS_UBOOT_BASE
@@ -145,6 +144,7 @@ reset:
  *
  *
  */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
/*
 * we do sys-critical inits only at reboot,
 * not when booting from ram!
@@ -170,6 +170,8 @@ cpu_init_crit:
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
+
+#ifdef CONFIG_ENABLE_MMU
/* Prepare to disable the MMU */
adr r1, mmu_disable_phys
/* We presume we're within the first 1024 bytes */
@@ -187,20 +189,60 @@ mmu_disable:
nop
nop
mov pc, r2
+mmu_disable_phys:
+#else
+   mcr p15, 0, r0, c1, c0, 0
 #endif
 
-mmu_disable_phys:
+#ifdef CONFIG_DISABLE_TCM
+   /*
+* Disable the TCMs
+*/
+   mrc p15, 0, r0, c0, c0, 2   /* Return TCM details */
+   cmp r0, #0
+   beq skip_tcmdisable
+   mov r1, #0
+   mov r2, #1
+   tst r0, r2
+   mcrne   p15, 0, r1, c9, c1, 1   /* Disable Instruction TCM if present*/
+   tst r0, r2, LSL #16
+   mcrne   p15, 0, r1, c9, c1, 0   /* Disable Data TCM if present*/
+skip_tcmdisable:
+#endif
+#endif
+
+#ifdef CONFIG_PERIPORT_REMAP
/* Peri port setup */
-   ldr r0, =0x7000
-   orr r0, r0, #0x13
+   ldr r0, =CONFIG_PERIPORT_BASE
+   orr r0, r0, #CONFIG_PERIPORT_SIZE
mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)
+#endif
 
/*
 * Go setup Memory and board specific bits prior to relocation.
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+relocate:  /* relocate U-Boot to RAM   */
+   adr r0, _start  /* r0 - current position of code   */
+   ldr r1, _TEXT_BASE  /* test if we run from flash or RAM */
+   cmp r0, r1  /* don't reloc during debug */
+   beq stack_setup
+
+   ldr r2, _armboot_start
+   ldr r3, _bss_start
+   sub r2, r3, r2  /* r2 - size of armboot*/
+   add r2, r0, r2

[U-Boot] [PATCH v2 0/3] TI: tnetv107x patch series

2010-03-31 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch series generalizes current
ARM1176 code to allow for the addition of new ARM1176 SOCs.  The remaining
patches in this series add arch and board support.

The contents of this series are identical to the larger patch posted earlier.
The only difference here is that these changes have been split up as per
feedback from Sandeep.


Cyril Chemparathy (3):
  ARM1176: Coexist with other ARM1176 platforms
  ARM1176: TI: TNETV107X soc initial support
  TI: TNETV107X EVM initial support

 MAINTAINERS|4 +
 MAKEALL|1 +
 Makefile   |3 +
 board/ti/tnetv107xevm/Makefile |   49 +++
 board/ti/tnetv107xevm/config.mk|   20 +
 board/ti/tnetv107xevm/sdb_board.c  |   66 
 cpu/arm1176/cpu.c  |1 -
 cpu/arm1176/start.S|   60 +++-
 cpu/arm1176/tnetv107x/Makefile |   44 +++
 cpu/arm1176/tnetv107x/aemif.c  |  151 
 cpu/arm1176/tnetv107x/clock.c  |  542 
 cpu/arm1176/tnetv107x/init.c   |   41 ++
 cpu/arm1176/tnetv107x/lowlevel_init.S  |   25 ++
 cpu/arm1176/tnetv107x/mux.c|  463 
 cpu/arm1176/tnetv107x/timer.c  |  125 +++
 cpu/arm1176/tnetv107x/wdt.c|  172 +
 include/asm-arm/arch-tnetv107x/clock.h |   50 +++
 include/asm-arm/arch-tnetv107x/emif_defs.h |1 +
 include/asm-arm/arch-tnetv107x/hardware.h  |  184 ++
 include/asm-arm/arch-tnetv107x/mux.h   |  307 
 include/asm-arm/arch-tnetv107x/nand_defs.h |   38 ++
 include/configs/smdk6400.h |6 +
 include/configs/tnetv107x_evm.h|  206 +++
 23 files changed, 2550 insertions(+), 9 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 cpu/arm1176/tnetv107x/Makefile
 create mode 100644 cpu/arm1176/tnetv107x/aemif.c
 create mode 100644 cpu/arm1176/tnetv107x/clock.c
 create mode 100644 cpu/arm1176/tnetv107x/init.c
 create mode 100644 cpu/arm1176/tnetv107x/lowlevel_init.S
 create mode 100644 cpu/arm1176/tnetv107x/mux.c
 create mode 100644 cpu/arm1176/tnetv107x/timer.c
 create mode 100644 cpu/arm1176/tnetv107x/wdt.c
 create mode 100644 include/asm-arm/arch-tnetv107x/clock.h
 create mode 100644 include/asm-arm/arch-tnetv107x/emif_defs.h
 create mode 100644 include/asm-arm/arch-tnetv107x/hardware.h
 create mode 100644 include/asm-arm/arch-tnetv107x/mux.h
 create mode 100644 include/asm-arm/arch-tnetv107x/nand_defs.h
 create mode 100644 include/configs/tnetv107x_evm.h

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/3] TI: TNETV107X EVM initial support

2010-03-31 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch adds support for the
TNETV107X EVM board.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
1. Added maintainers entry
2. Fixed sort order in main makefile
3. Remove board specific linker script
4. Style fixes - multiline comments
5. Replaced clk_get() with clk_get_rate()

 MAINTAINERS   |4 +
 MAKEALL   |1 +
 Makefile  |3 +
 board/ti/tnetv107xevm/Makefile|   49 +
 board/ti/tnetv107xevm/config.mk   |   20 
 board/ti/tnetv107xevm/sdb_board.c |   66 
 include/configs/tnetv107x_evm.h   |  206 +
 7 files changed, 349 insertions(+), 0 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 include/configs/tnetv107x_evm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index bb03f17..daa074c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -62,6 +62,10 @@ Oliver Brown obr...@adventnetworks.com
 
gw8260  MPC8260
 
+Cyril Chemparathy cy...@ti.com
+
+   tnetv107x_evm   tnetv107x
+
 Conn Clark cl...@esteem.com
 
ESTEEM192E  MPC8xx
diff --git a/MAKEALL b/MAKEALL
index a88c31e..63d8d16 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -623,6 +623,7 @@ LIST_ARM11=\
mx31pdk_nand\
qong\
smdk6400\
+   tnetv107x_evm   \
 
 
 #
diff --git a/Makefile b/Makefile
index c0e73de..0e509d0 100644
--- a/Makefile
+++ b/Makefile
@@ -3313,6 +3313,9 @@ smdk6400_config   :   unconfig
fi
@echo CONFIG_NAND_U_BOOT = y  $(obj)include/config.mk
 
+tnetv107x_evm_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm1176 tnetv107xevm ti tnetv107x
+
 #
 # i386
 #
diff --git a/board/ti/tnetv107xevm/Makefile b/board/ti/tnetv107xevm/Makefile
new file mode 100644
index 000..2446c2a
--- /dev/null
+++ b/board/ti/tnetv107xevm/Makefile
@@ -0,0 +1,49 @@
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  += sdb_board.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+.PHONY: all
+
+all: $(LIB)
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak *~ .depend
+
+#
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/ti/tnetv107xevm/config.mk b/board/ti/tnetv107xevm/config.mk
new file mode 100644
index 000..d24d49a
--- /dev/null
+++ b/board/ti/tnetv107xevm/config.mk
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+TEXT_BASE = 0x83FC
diff --git a/board/ti/tnetv107xevm/sdb_board.c 
b/board/ti/tnetv107xevm/sdb_board.c
new file mode 100644
index 000

[U-Boot] [PATCH 1/3] ARM1176: Coexist with other ARM1176 platforms

2010-03-29 Thread Cyril Chemparathy
The current ARM1176 CPU specific code is too specific to the SMDK6400
architecture.  The following changes were necessary prerequisites for the
addition of other SoCs based on ARM1176.

Existing board's (SMDK6400) configuration has been modified to keep behavior
unchanged despite these changes.

1. Peripheral port remap configurability
The earlier code had hardcoded remap values specific to s3c64xx in start.S.
This change makes the peripheral port remap addresses and sizes configurable.

2. Skip low level initialization
Ability to skip low level initialization if necessary.  Many other platforms
have a similar capability, and this is quite useful during debug/bring-up.

3. U-Boot code relocation support
Most architectures allow u-boot code to run initially at a different
address (possibly in NOR) and then get relocated to its final resting place
in RAM.  Added support for this capability in ARM1176 architecture.

4. Disable TCM if necessary
If a ROM based bootloader happened to have initialized TCM, we disable it here
to keep things sane.

5. Remove unnecessary SoC specific includes
ARM1176 code does not really need this SoC specific include.  The presence
of this include prevents builds on other ARM1176 archs.

6. ARM926 style MMU disable when !CONFIG_ENABLE_MMU
The original MMU disable code masks out too many bits from the load address
when it tries to figure out the physical address of the jump target label.
Consequently, it ends up branching to the wrong address after disabling the
MMU.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
 cpu/arm1176/cpu.c  |1 -
 cpu/arm1176/start.S|   60 ++--
 include/configs/smdk6400.h |6 
 3 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/cpu/arm1176/cpu.c b/cpu/arm1176/cpu.c
index 2c0014f..c0fd114 100644
--- a/cpu/arm1176/cpu.c
+++ b/cpu/arm1176/cpu.c
@@ -33,7 +33,6 @@
 
 #include common.h
 #include command.h
-#include asm/arch/s3c6400.h
 #include asm/system.h
 
 static void cache_flush (void);
diff --git a/cpu/arm1176/start.S b/cpu/arm1176/start.S
index 68a356d..beec574 100644
--- a/cpu/arm1176/start.S
+++ b/cpu/arm1176/start.S
@@ -1,5 +1,5 @@
 /*
- *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *  armboot - Startup Code for ARM1176 CPU-core
  *
  * Copyright (c) 2007  Samsung Electronics
  *
@@ -35,7 +35,6 @@
 #ifdef CONFIG_ENABLE_MMU
 #include asm/proc/domain.h
 #endif
-#include asm/arch/s3c6400.h
 
 #if !defined(CONFIG_ENABLE_MMU)  !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE  CONFIG_SYS_UBOOT_BASE
@@ -145,6 +144,7 @@ reset:
  *
  *
  */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
/*
 * we do sys-critical inits only at reboot,
 * not when booting from ram!
@@ -170,6 +170,8 @@ cpu_init_crit:
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
+
+#ifdef CONFIG_ENABLE_MMU
/* Prepare to disable the MMU */
adr r1, mmu_disable_phys
/* We presume we're within the first 1024 bytes */
@@ -187,20 +189,60 @@ mmu_disable:
nop
nop
mov pc, r2
+mmu_disable_phys:
+#else
+   mcr p15, 0, r0, c1, c0, 0
 #endif
 
-mmu_disable_phys:
+#ifdef CONFIG_DISABLE_TCM
+   /*
+* Disable the TCMs
+*/
+   mrc p15, 0, r0, c0, c0, 2   /* Return TCM details */
+   cmp r0, #0
+   beq skip_tcmdisable
+   mov r1, #0
+   mov r2, #1
+   tst r0, r2
+   mcrne   p15, 0, r1, c9, c1, 1   /* Disable Instruction TCM if present*/
+   tst r0, r2, LSL #16
+   mcrne   p15, 0, r1, c9, c1, 0   /* Disable Data TCM if present*/
+skip_tcmdisable:
+#endif
+#endif
+
+#ifdef CONFIG_PERIPORT_REMAP
/* Peri port setup */
-   ldr r0, =0x7000
-   orr r0, r0, #0x13
+   ldr r0, =CONFIG_PERIPORT_BASE
+   orr r0, r0, #CONFIG_PERIPORT_SIZE
mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)
+#endif
 
/*
 * Go setup Memory and board specific bits prior to relocation.
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+relocate:  /* relocate U-Boot to RAM   */
+   adr r0, _start  /* r0 - current position of code   */
+   ldr r1, _TEXT_BASE  /* test if we run from flash or RAM */
+   cmp r0, r1  /* don't reloc during debug */
+   beq stack_setup
+
+   ldr r2, _armboot_start
+   ldr r3, _bss_start
+   sub r2, r3, r2  /* r2 - size of armboot*/
+   add r2, r0, r2  /* r2 - source

[U-Boot] [PATCH 0/3] TI: tnetv107x patch series

2010-03-29 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch series generalizes current
ARM1176 code to allow for the addition of new ARM1176 SOCs.  The remaining
patches in this series add arch and board support.

The contents of this series are identical to the larger patch posted earlier.
The only difference here is that these changes have been split up as per
feedback from Sandeep.


Cyril Chemparathy (3):
  ARM1176: Coexist with other ARM1176 platforms
  ARM1176: TI: TNETV107X soc initial support
  TI: TNETV107X EVM initial support

 MAKEALL|1 +
 Makefile   |3 +
 board/ti/tnetv107xevm/Makefile |   49 +++
 board/ti/tnetv107xevm/config.mk|   20 +
 board/ti/tnetv107xevm/sdb_board.c  |   66 
 board/ti/tnetv107xevm/u-boot.lds   |   48 +++
 cpu/arm1176/cpu.c  |1 -
 cpu/arm1176/start.S|   60 +++-
 cpu/arm1176/tnetv107x/Makefile |   44 +++
 cpu/arm1176/tnetv107x/aemif.c  |  173 +
 cpu/arm1176/tnetv107x/clock.c  |  562 
 cpu/arm1176/tnetv107x/init.c   |   41 ++
 cpu/arm1176/tnetv107x/lowlevel_init.S  |   25 ++
 cpu/arm1176/tnetv107x/mux.c|  463 +++
 cpu/arm1176/tnetv107x/timer.c  |  125 ++
 cpu/arm1176/tnetv107x/wdt.c|  172 +
 include/asm-arm/arch-tnetv107x/clock.h |   43 +++
 include/asm-arm/arch-tnetv107x/emif_defs.h |1 +
 include/asm-arm/arch-tnetv107x/hardware.h  |  184 +
 include/asm-arm/arch-tnetv107x/mux.h   |  307 +++
 include/asm-arm/arch-tnetv107x/nand_defs.h |   38 ++
 include/configs/smdk6400.h |6 +
 include/configs/tnetv107x_evm.h|  225 +++
 23 files changed, 2648 insertions(+), 9 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 board/ti/tnetv107xevm/u-boot.lds
 create mode 100644 cpu/arm1176/tnetv107x/Makefile
 create mode 100644 cpu/arm1176/tnetv107x/aemif.c
 create mode 100644 cpu/arm1176/tnetv107x/clock.c
 create mode 100644 cpu/arm1176/tnetv107x/init.c
 create mode 100644 cpu/arm1176/tnetv107x/lowlevel_init.S
 create mode 100644 cpu/arm1176/tnetv107x/mux.c
 create mode 100644 cpu/arm1176/tnetv107x/timer.c
 create mode 100644 cpu/arm1176/tnetv107x/wdt.c
 create mode 100644 include/asm-arm/arch-tnetv107x/clock.h
 create mode 100644 include/asm-arm/arch-tnetv107x/emif_defs.h
 create mode 100644 include/asm-arm/arch-tnetv107x/hardware.h
 create mode 100644 include/asm-arm/arch-tnetv107x/mux.h
 create mode 100644 include/asm-arm/arch-tnetv107x/nand_defs.h
 create mode 100644 include/configs/tnetv107x_evm.h

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/3] TI: TNETV107X EVM initial support

2010-03-29 Thread Cyril Chemparathy
TNETV107X is a Texas Instruments SoC based on an ARM1176 core, and with a
bunch on on-chip integrated peripherals.  This patch adds support for the
TNETV107X EVM board.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
 MAKEALL   |1 +
 Makefile  |3 +
 board/ti/tnetv107xevm/Makefile|   49 
 board/ti/tnetv107xevm/config.mk   |   20 
 board/ti/tnetv107xevm/sdb_board.c |   66 +++
 board/ti/tnetv107xevm/u-boot.lds  |   48 
 include/configs/tnetv107x_evm.h   |  225 +
 7 files changed, 412 insertions(+), 0 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 board/ti/tnetv107xevm/u-boot.lds
 create mode 100644 include/configs/tnetv107x_evm.h

diff --git a/MAKEALL b/MAKEALL
index a88c31e..63d8d16 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -623,6 +623,7 @@ LIST_ARM11=\
mx31pdk_nand\
qong\
smdk6400\
+   tnetv107x_evm   \
 
 
 #
diff --git a/Makefile b/Makefile
index c0e73de..e723e7c 100644
--- a/Makefile
+++ b/Makefile
@@ -2936,6 +2936,9 @@ davinci_dm365evm_config : unconfig
 davinci_dm6467evm_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm926ejs dm6467evm davinci davinci
 
+tnetv107x_evm_config: unconfig
+   @$(MKCONFIG) $(@:_config=) arm arm1176 tnetv107xevm ti tnetv107x
+
 imx27lite_config:  unconfig
@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
 
diff --git a/board/ti/tnetv107xevm/Makefile b/board/ti/tnetv107xevm/Makefile
new file mode 100644
index 000..2446c2a
--- /dev/null
+++ b/board/ti/tnetv107xevm/Makefile
@@ -0,0 +1,49 @@
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).a
+
+COBJS  += sdb_board.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+.PHONY: all
+
+all: $(LIB)
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak *~ .depend
+
+#
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/ti/tnetv107xevm/config.mk b/board/ti/tnetv107xevm/config.mk
new file mode 100644
index 000..d24d49a
--- /dev/null
+++ b/board/ti/tnetv107xevm/config.mk
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+TEXT_BASE = 0x83FC
diff --git a/board/ti/tnetv107xevm/sdb_board.c 
b/board/ti/tnetv107xevm/sdb_board.c
new file mode 100644
index 000..fa7b49c
--- /dev/null
+++ b/board/ti/tnetv107xevm/sdb_board.c
@@ -0,0 +1,66 @@
+/*
+ * TNETV107X-EVM: Board initialization
+ *
+ * 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

[U-Boot] [PATCH v3] TI: Davinci: NAND Driver Cleanup

2010-03-17 Thread Cyril Chemparathy
Modified to use IO accessor routines consistently.  Eliminated volatile usage
to keep checkpatch.pl happy.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
Minor formatting

 board/davinci/da830evm/da830evm.c|2 +-
 drivers/mtd/nand/davinci_nand.c  |  128 --
 include/asm-arm/arch-davinci/emif_defs.h |   77 --
 3 files changed, 106 insertions(+), 101 deletions(-)

diff --git a/board/davinci/da830evm/da830evm.c 
b/board/davinci/da830evm/da830evm.c
index ed668af..6385443 100644
--- a/board/davinci/da830evm/da830evm.c
+++ b/board/davinci/da830evm/da830evm.c
@@ -150,7 +150,7 @@ int board_init(void)
DAVINCI_ABCR_RHOLD(0) |
DAVINCI_ABCR_TA(2) |
DAVINCI_ABCR_ASIZE_8BIT),
-  davinci_emif_regs-AB2CR);
+  davinci_emif_regs-ab2cr);
 #endif
 
/* arch number of the board */
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index bfc2acf..4ca738e 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -57,8 +57,6 @@
 #define ECC_STATE_ERR_CORR_COMP_P  0x2
 #define ECC_STATE_ERR_CORR_COMP_N  0x3
 
-static emif_registers *const emif_regs = (void *) 
DAVINCI_ASYNC_EMIF_CNTRL_BASE;
-
 /*
  * Exploit the little endianness of the ARM to do multi-byte transfers
  * per device read. This can perform over twice as quickly as individual
@@ -93,7 +91,7 @@ static void nand_davinci_read_buf(struct mtd_info *mtd, 
uint8_t *buf, int len)
 
/* copy aligned data */
while (len = 4) {
-   *(u32 *)buf = readl(nand);
+   *(u32 *)buf = __raw_readl(nand);
buf += 4;
len -= 4;
}
@@ -138,7 +136,7 @@ static void nand_davinci_write_buf(struct mtd_info *mtd, 
const uint8_t *buf,
 
/* copy aligned data */
while (len = 4) {
-   writel(*(u32 *)buf, nand);
+   __raw_writel(*(u32 *)buf, nand);
buf += 4;
len -= 4;
}
@@ -156,7 +154,8 @@ static void nand_davinci_write_buf(struct mtd_info *mtd, 
const uint8_t *buf,
}
 }
 
-static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int 
ctrl)
+static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd,
+   unsigned int ctrl)
 {
struct  nand_chip *this = mtd-priv;
u_int32_t   IO_ADDR_W = (u_int32_t)this-IO_ADDR_W;
@@ -164,9 +163,9 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, 
int cmd, unsigned int c
if (ctrl  NAND_CTRL_CHANGE) {
IO_ADDR_W = ~(MASK_ALE|MASK_CLE);
 
-   if ( ctrl  NAND_CLE )
+   if (ctrl  NAND_CLE)
IO_ADDR_W |= MASK_CLE;
-   if ( ctrl  NAND_ALE )
+   if (ctrl  NAND_ALE)
IO_ADDR_W |= MASK_ALE;
this-IO_ADDR_W = (void __iomem *) IO_ADDR_W;
}
@@ -181,24 +180,26 @@ static void nand_davinci_enable_hwecc(struct mtd_info 
*mtd, int mode)
 {
u_int32_t   val;
 
-   (void)readl((emif_regs-NANDFECC[CONFIG_SYS_NAND_CS - 2]));
+   (void)__raw_readl((davinci_emif_regs-nandfecc[
+   CONFIG_SYS_NAND_CS - 2]));
 
-   val = readl(emif_regs-NANDFCR);
+   val = __raw_readl(davinci_emif_regs-nandfcr);
val |= DAVINCI_NANDFCR_NAND_ENABLE(CONFIG_SYS_NAND_CS);
val |= DAVINCI_NANDFCR_1BIT_ECC_START(CONFIG_SYS_NAND_CS);
-   writel(val, emif_regs-NANDFCR);
+   __raw_writel(val, davinci_emif_regs-nandfcr);
 }
 
 static u_int32_t nand_davinci_readecc(struct mtd_info *mtd, u_int32_t region)
 {
u_int32_t   ecc = 0;
 
-   ecc = readl((emif_regs-NANDFECC[region - 1]));
+   ecc = __raw_readl((davinci_emif_regs-nandfecc[region - 1]));
 
-   return(ecc);
+   return ecc;
 }
 
-static int nand_davinci_calculate_ecc(struct mtd_info *mtd, const u_char *dat, 
u_char *ecc_code)
+static int nand_davinci_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
+   u_char *ecc_code)
 {
u_int32_t   tmp;
const int region = 1;
@@ -232,7 +233,8 @@ static int nand_davinci_calculate_ecc(struct mtd_info *mtd, 
const u_char *dat, u
return 0;
 }
 
-static int nand_davinci_correct_data(struct mtd_info *mtd, u_char *dat, u_char 
*read_ecc, u_char *calc_ecc)
+static int nand_davinci_correct_data(struct mtd_info *mtd, u_char *dat,
+   u_char *read_ecc, u_char *calc_ecc)
 {
struct nand_chip *this = mtd-priv;
u_int32_t ecc_nand = read_ecc[0] | (read_ecc[1]  8) |
@@ -268,7 +270,7 @@ static int nand_davinci_correct_data(struct mtd_info *mtd, 
u_char *dat, u_char *
return -1;
}
}
-   return(0);
+   return 0;
 }
 #endif /* CONFIG_SYS_NAND_HW_ECC */
 
@@ -315,15 +317,15 @@ static void nand_davinci_4bit_enable_hwecc(struct 
mtd_info *mtd

[U-Boot] [PATCH v2 1/1] TI: Davinci: NAND Driver Cleanup

2010-03-16 Thread Cyril Chemparathy
Modified to use IO accessor routines consistently.  Eliminated volatile usage
to keep checkpatch.pl happy.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
1. Added fixes for DA830 EVM and Davinci Schmoogie boards
2. Reverted to include davinci_emif_regs macro definition

 board/davinci/da830evm/da830evm.c|2 +-
 drivers/mtd/nand/davinci_nand.c  |  125 --
 include/asm-arm/arch-davinci/emif_defs.h |   80 +--
 3 files changed, 105 insertions(+), 102 deletions(-)

diff --git a/board/davinci/da830evm/da830evm.c 
b/board/davinci/da830evm/da830evm.c
index ed668af..6385443 100644
--- a/board/davinci/da830evm/da830evm.c
+++ b/board/davinci/da830evm/da830evm.c
@@ -150,7 +150,7 @@ int board_init(void)
DAVINCI_ABCR_RHOLD(0) |
DAVINCI_ABCR_TA(2) |
DAVINCI_ABCR_ASIZE_8BIT),
-  davinci_emif_regs-AB2CR);
+  davinci_emif_regs-ab2cr);
 #endif
 
/* arch number of the board */
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index bfc2acf..1b2141b 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -57,8 +57,6 @@
 #define ECC_STATE_ERR_CORR_COMP_P  0x2
 #define ECC_STATE_ERR_CORR_COMP_N  0x3
 
-static emif_registers *const emif_regs = (void *) 
DAVINCI_ASYNC_EMIF_CNTRL_BASE;
-
 /*
  * Exploit the little endianness of the ARM to do multi-byte transfers
  * per device read. This can perform over twice as quickly as individual
@@ -93,7 +91,7 @@ static void nand_davinci_read_buf(struct mtd_info *mtd, 
uint8_t *buf, int len)
 
/* copy aligned data */
while (len = 4) {
-   *(u32 *)buf = readl(nand);
+   *(u32 *)buf = __raw_readl(nand);
buf += 4;
len -= 4;
}
@@ -138,7 +136,7 @@ static void nand_davinci_write_buf(struct mtd_info *mtd, 
const uint8_t *buf,
 
/* copy aligned data */
while (len = 4) {
-   writel(*(u32 *)buf, nand);
+   __raw_writel(*(u32 *)buf, nand);
buf += 4;
len -= 4;
}
@@ -156,7 +154,8 @@ static void nand_davinci_write_buf(struct mtd_info *mtd, 
const uint8_t *buf,
}
 }
 
-static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int 
ctrl)
+static void nand_davinci_hwcontrol(struct mtd_info *mtd, int cmd,
+   unsigned int ctrl)
 {
struct  nand_chip *this = mtd-priv;
u_int32_t   IO_ADDR_W = (u_int32_t)this-IO_ADDR_W;
@@ -164,9 +163,9 @@ static void nand_davinci_hwcontrol(struct mtd_info *mtd, 
int cmd, unsigned int c
if (ctrl  NAND_CTRL_CHANGE) {
IO_ADDR_W = ~(MASK_ALE|MASK_CLE);
 
-   if ( ctrl  NAND_CLE )
+   if (ctrl  NAND_CLE)
IO_ADDR_W |= MASK_CLE;
-   if ( ctrl  NAND_ALE )
+   if (ctrl  NAND_ALE)
IO_ADDR_W |= MASK_ALE;
this-IO_ADDR_W = (void __iomem *) IO_ADDR_W;
}
@@ -181,24 +180,25 @@ static void nand_davinci_enable_hwecc(struct mtd_info 
*mtd, int mode)
 {
u_int32_t   val;
 
-   (void)readl((emif_regs-NANDFECC[CONFIG_SYS_NAND_CS - 2]));
+   (void)__raw_readl((davinci_emif_regs-nandfecc[CONFIG_SYS_NAND_CS - 
2]));
 
-   val = readl(emif_regs-NANDFCR);
+   val = __raw_readl(davinci_emif_regs-nandfcr);
val |= DAVINCI_NANDFCR_NAND_ENABLE(CONFIG_SYS_NAND_CS);
val |= DAVINCI_NANDFCR_1BIT_ECC_START(CONFIG_SYS_NAND_CS);
-   writel(val, emif_regs-NANDFCR);
+   __raw_writel(val, davinci_emif_regs-nandfcr);
 }
 
 static u_int32_t nand_davinci_readecc(struct mtd_info *mtd, u_int32_t region)
 {
u_int32_t   ecc = 0;
 
-   ecc = readl((emif_regs-NANDFECC[region - 1]));
+   ecc = __raw_readl((davinci_emif_regs-nandfecc[region - 1]));
 
-   return(ecc);
+   return ecc;
 }
 
-static int nand_davinci_calculate_ecc(struct mtd_info *mtd, const u_char *dat, 
u_char *ecc_code)
+static int nand_davinci_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
+   u_char *ecc_code)
 {
u_int32_t   tmp;
const int region = 1;
@@ -232,7 +232,8 @@ static int nand_davinci_calculate_ecc(struct mtd_info *mtd, 
const u_char *dat, u
return 0;
 }
 
-static int nand_davinci_correct_data(struct mtd_info *mtd, u_char *dat, u_char 
*read_ecc, u_char *calc_ecc)
+static int nand_davinci_correct_data(struct mtd_info *mtd, u_char *dat,
+   u_char *read_ecc, u_char *calc_ecc)
 {
struct nand_chip *this = mtd-priv;
u_int32_t ecc_nand = read_ecc[0] | (read_ecc[1]  8) |
@@ -268,7 +269,7 @@ static int nand_davinci_correct_data(struct mtd_info *mtd, 
u_char *dat, u_char *
return -1;
}
}
-   return(0);
+   return 0;
 }
 #endif /* CONFIG_SYS_NAND_HW_ECC */
 
@@ -315,15 +316,15

[U-Boot] [PATCH] ARM1176: Coexist with other ARM1176 platforms

2010-03-11 Thread Cyril Chemparathy
The current ARM1176 CPU specific code is too specific to the SMDK6400
architecture.  The following changes were necessary prerequisites for the
addition of other SoCs based on ARM1176.

Existing board's (SMDK6400) configuration has been modified to keep behavior
unchanged despite these changes.

1. Peripheral port remap configurability
The earlier code had hardcoded remap values specific to s3c64xx in start.S.
This change makes the peripheral port remap addresses and sizes configurable.

2. Skip low level initialization
Ability to skip low level initialization if necessary.  Many other platforms
have a similar capability, and this is quite useful during debug/bring-up.

3. U-Boot code relocation support
Most architectures allow u-boot code to run initially at a different
address (possibly in NOR) and then get relocated to its final resting place
in RAM.  Added support for this capability in ARM1176 architecture.

4. Disable TCM if necessary
If a ROM based bootloader happened to have initialized TCM, we disable it here
to keep things sane.

5. Remove unnecessary SoC specific includes
ARM1176 code does not really need this SoC specific include.  The presence
of this include prevents builds on other ARM1176 archs.

6. ARM926 style MMU disable when !CONFIG_ENABLE_MMU
The original MMU disable code masks out too many bits from the load address
when it tries to figure out the physical address of the jump target label.
Consequently, it ends up branching to the wrong address after disabling the
MMU.

Signed-off-by: Cyril Chemparathy cy...@ti.com
---
 cpu/arm1176/cpu.c  |1 -
 cpu/arm1176/start.S|   60 ++--
 include/configs/smdk6400.h |6 
 3 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/cpu/arm1176/cpu.c b/cpu/arm1176/cpu.c
index 2c0014f..c0fd114 100644
--- a/cpu/arm1176/cpu.c
+++ b/cpu/arm1176/cpu.c
@@ -33,7 +33,6 @@
 
 #include common.h
 #include command.h
-#include asm/arch/s3c6400.h
 #include asm/system.h
 
 static void cache_flush (void);
diff --git a/cpu/arm1176/start.S b/cpu/arm1176/start.S
index 68a356d..beec574 100644
--- a/cpu/arm1176/start.S
+++ b/cpu/arm1176/start.S
@@ -1,5 +1,5 @@
 /*
- *  armboot - Startup Code for S3C6400/ARM1176 CPU-core
+ *  armboot - Startup Code for ARM1176 CPU-core
  *
  * Copyright (c) 2007  Samsung Electronics
  *
@@ -35,7 +35,6 @@
 #ifdef CONFIG_ENABLE_MMU
 #include asm/proc/domain.h
 #endif
-#include asm/arch/s3c6400.h
 
 #if !defined(CONFIG_ENABLE_MMU)  !defined(CONFIG_SYS_PHY_UBOOT_BASE)
 #define CONFIG_SYS_PHY_UBOOT_BASE  CONFIG_SYS_UBOOT_BASE
@@ -145,6 +144,7 @@ reset:
  *
  *
  */
+#ifndef CONFIG_SKIP_LOWLEVEL_INIT
/*
 * we do sys-critical inits only at reboot,
 * not when booting from ram!
@@ -170,6 +170,8 @@ cpu_init_crit:
bic r0, r0, #0x0087 @ clear bits 7, 2:0 (B--- -CAM)
orr r0, r0, #0x0002 @ set bit 2 (A) Align
orr r0, r0, #0x1000 @ set bit 12 (I) I-Cache
+
+#ifdef CONFIG_ENABLE_MMU
/* Prepare to disable the MMU */
adr r1, mmu_disable_phys
/* We presume we're within the first 1024 bytes */
@@ -187,20 +189,60 @@ mmu_disable:
nop
nop
mov pc, r2
+mmu_disable_phys:
+#else
+   mcr p15, 0, r0, c1, c0, 0
 #endif
 
-mmu_disable_phys:
+#ifdef CONFIG_DISABLE_TCM
+   /*
+* Disable the TCMs
+*/
+   mrc p15, 0, r0, c0, c0, 2   /* Return TCM details */
+   cmp r0, #0
+   beq skip_tcmdisable
+   mov r1, #0
+   mov r2, #1
+   tst r0, r2
+   mcrne   p15, 0, r1, c9, c1, 1   /* Disable Instruction TCM if present*/
+   tst r0, r2, LSL #16
+   mcrne   p15, 0, r1, c9, c1, 0   /* Disable Data TCM if present*/
+skip_tcmdisable:
+#endif
+#endif
+
+#ifdef CONFIG_PERIPORT_REMAP
/* Peri port setup */
-   ldr r0, =0x7000
-   orr r0, r0, #0x13
+   ldr r0, =CONFIG_PERIPORT_BASE
+   orr r0, r0, #CONFIG_PERIPORT_SIZE
mcr p15,0,r0,c15,c2,4   @ 256M (0x7000 - 0x7fff)
+#endif
 
/*
 * Go setup Memory and board specific bits prior to relocation.
 */
bl  lowlevel_init   /* go setup pll,mux,memory */
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
+
+#ifndef CONFIG_SKIP_RELOCATE_UBOOT
+relocate:  /* relocate U-Boot to RAM   */
+   adr r0, _start  /* r0 - current position of code   */
+   ldr r1, _TEXT_BASE  /* test if we run from flash or RAM */
+   cmp r0, r1  /* don't reloc during debug */
+   beq stack_setup
+
+   ldr r2, _armboot_start
+   ldr r3, _bss_start
+   sub r2, r3, r2  /* r2 - size of armboot*/
+   add r2, r0, r2  /* r2 - source