Re: [U-Boot] [PATCH v2 2/2] TI: DaVinci: Add board specific code for da850 EVM

2010-05-26 Thread Ben Gardiner
On Fri, May 21, 2010 at 1:39 AM, Sudhakar Rajashekhara
sudhakar@ti.com wrote:
 Provides initial support for TI OMAP-L138/DA850 SoC devices on
 a Logic PD EVM board.

 Provides:
 Initial boot and configuration.
 Support for i2c.
 UART support (console).

 Signed-off-by: Sudhakar Rajashekhara sudhakar@ti.com

This is great! With the NAND defines of the da850 config from the
omap-l1 git repo this patch set also provides NAND reading and writing
on the da850evm. I'm looking forward to future da850 support patches!

I got one whitespace error applying this patch on-top of 'da830: Move
common code out of da830evm.c file' and 'TI: DaVinci: Prepare for
da850 support' starting with 40792d675a609c83621d098e48a89de07463b3cd
of git://git.denx.de/u-boot.git .

--
Applying: TI: DaVinci: Add board specific code for da850 EVM
removed.git/rebase-apply/patch:83: new blank line at EOF.
+
warning: 1 line adds whitespace errors.
--

 +
 +static const struct lpsc_resource lpsc[] = {
 +       DAVINCI_LPSC_AEMIF,     /* NAND, NOR */
 +       DAVINCI_LPSC_SPI1,      /* Serial Flash */
 +       DAVINCI_LPSC_EMAC,      /* image download */
 +       DAVINCI_LPSC_UART2,     /* console */
 +       DAVINCI_LPSC_GPIO,
 +};

I get the following warning when compiling :

--
da850evm.c:65: warning: missing braces around initializer
da850evm.c:65: warning: (near initialization for 'lpsc[0]')
--

which can be fixed by the following:

diff --git a/board/davinci/da8xxevm/da850evm.c
b/board/davinci/da8xxevm/da850evm.c
index 197df22..ba70352 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -62,11 +62,11 @@ static const struct pinmux_resource pinmuxes[] = {
 };

 static const struct lpsc_resource lpsc[] = {
-   DAVINCI_LPSC_AEMIF, /* NAND, NOR */
-   DAVINCI_LPSC_SPI1,  /* Serial Flash */
-   DAVINCI_LPSC_EMAC,  /* image download */
-   DAVINCI_LPSC_UART2, /* console */
-   DAVINCI_LPSC_GPIO,
+   { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
+   { DAVINCI_LPSC_SPI1 },  /* Serial Flash */
+   { DAVINCI_LPSC_EMAC },  /* image download */
+   { DAVINCI_LPSC_UART2 }, /* console */
+   { DAVINCI_LPSC_GPIO },
 };

 int board_init(void)


 +
 +int board_init(void)
 +{
 +#ifndef CONFIG_USE_IRQ
 +       irq_init();
 +#endif

If CONFIG_USE_IRQ is defined (as it is in the da850evm config in the
omap-l1 git repo) I get the following warning:

--
da850evm.c: In function 'board_init':
da850evm.c:75: warning: implicit declaration of function 'irq_init'
--

which can be fixed by the following:

diff --git a/board/davinci/common/misc.h b/board/davinci/common/misc.h
index 84fafe9..ee35f01 100644
--- a/board/davinci/common/misc.h
+++ b/board/davinci/common/misc.h
@@ -49,6 +49,7 @@ struct lpsc_resource {
const int   lpsc_no;
 };

+void irq_init(void);
 int dvevm_read_mac_address(uint8_t *buf);
 void dv_configure_mac_address(uint8_t *rom_enetaddr);
 int davinci_configure_pin_mux(const struct pinmux_config *pins, int n_pins);

 diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
 new file mode 100644
 index 000..8fa7f01
 --- /dev/null
 +++ b/include/configs/da850evm.h
 @@ -0,0 +1,140 @@
 +/*
 + * Copyright (C) 2010 Texas Instruments Incorporated
 + *
 + * Based on davinci_dvevm.h. Original Copyrights follow:
 + *
 + * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 + */
 +
 +#ifndef __CONFIG_H
 +#define __CONFIG_H
 +
 +/*
 + * Board
 + */
 +
 +/*
 + * SoC Configuration
 + */
 +#define CONFIG_MACH_DAVINCI_DA850_EVM

from here

 +#define CONFIG_ARM926EJS               /* arm926ejs CPU core */
 +#define CONFIG_SOC_DA8XX               /* TI DA8xx SoC */
 +#define CONFIG_SYS_CLK_FREQ            clk_get(DAVINCI_ARM_CLKID)
 +#define CONFIG_SYS_OSCIN_FREQ          2400
 +#define CONFIG_SYS_TIMERBASE           DAVINCI_TIMER0_BASE
 +#define CONFIG_SYS_HZ_CLOCK            clk_get(DAVINCI_AUXCLK_CLKID)
 +#define CONFIG_SYS_HZ                  1000
 +#define CONFIG_SKIP_LOWLEVEL_INIT
 +#define CONFIG_SKIP_RELOCATE_UBOOT     /* to a proper address, init done */
 +
 +/*
 + * Memory Info
 + */
 +#define CONFIG_SYS_MALLOC_LEN  (0x1 + 1*1024*1024) /* malloc() len */
 +#define CONFIG_SYS_GBL_DATA_SIZE       128 /* reserved for 

[U-Boot] [PATCH v2 2/2] TI: DaVinci: Add board specific code for da850 EVM

2010-05-20 Thread Sudhakar Rajashekhara
Provides initial support for TI OMAP-L138/DA850 SoC devices on
a Logic PD EVM board.

Provides:
Initial boot and configuration.
Support for i2c.
UART support (console).

Signed-off-by: Sudhakar Rajashekhara sudhakar@ti.com
---
 MAINTAINERS  |4 +
 MAKEALL  |1 +
 Makefile |3 +-
 arch/arm/include/asm/arch-davinci/hardware.h |1 +
 board/davinci/da8xxevm/Makefile  |1 +
 board/davinci/da8xxevm/da850evm.c|  111 
 include/configs/da850evm.h   |  140 ++
 7 files changed, 260 insertions(+), 1 deletions(-)
 create mode 100644 board/davinci/da8xxevm/da850evm.c
 create mode 100644 include/configs/da850evm.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 5cbc845..82e0692 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -349,6 +349,10 @@ Daniel Poirot dan.poi...@windriver.com
sbc8240 MPC8240
sbc405  PPC405GP
 
+Sudhakar Rajashekhara sudhakar@ti.com
+
+   da850evmARM926EJS (DA850/OMAP-L138)
+
 Ricardo Ribalda ricardo.riba...@uam.es
 
ml507   PPC440x5
diff --git a/MAKEALL b/MAKEALL
index bb09627..4f7f23e 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -561,6 +561,7 @@ LIST_ARM9= \
cp946es \
cp966   \
da830evm\
+   da850evm\
edb9301 \
edb9302 \
edb9302a\
diff --git a/Makefile b/Makefile
index 3668cda..4fcbd8f 100644
--- a/Makefile
+++ b/Makefile
@@ -2916,7 +2916,8 @@ cp922_XA10_config \
 cp1026_config: unconfig
@board/armltd/integrator/split_by_variant.sh cp $@
 
-da830evm_config:   unconfig
+da830evm_config\
+da850evm_config:   unconfig
@$(MKCONFIG) $(@:_config=) arm arm926ejs da8xxevm davinci davinci
 
 davinci_dvevm_config : unconfig
diff --git a/arch/arm/include/asm/arch-davinci/hardware.h 
b/arch/arm/include/asm/arch-davinci/hardware.h
index 81cc8ab..3520cf8 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -398,6 +398,7 @@ struct davinci_syscfg_regs {
 #define DAVINCI_SYSCFG_SUSPSRC_EMAC(1  5)
 #define DAVINCI_SYSCFG_SUSPSRC_I2C (1  16)
 #define DAVINCI_SYSCFG_SUSPSRC_SPI0(1  21)
+#define DAVINCI_SYSCFG_SUSPSRC_SPI1(1  22)
 #define DAVINCI_SYSCFG_SUSPSRC_UART2   (1  20)
 #define DAVINCI_SYSCFG_SUSPSRC_TIMER0  (1  27)
 
diff --git a/board/davinci/da8xxevm/Makefile b/board/davinci/da8xxevm/Makefile
index 20f4915..bcf315c 100644
--- a/board/davinci/da8xxevm/Makefile
+++ b/board/davinci/da8xxevm/Makefile
@@ -28,6 +28,7 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)lib$(BOARD).a
 
 COBJS-$(CONFIG_MACH_DAVINCI_DA830_EVM) += da830evm.o
+COBJS-$(CONFIG_MACH_DAVINCI_DA850_EVM) += da850evm.o
 
 COBJS   := $(sort $(COBJS-y))
 
diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
new file mode 100644
index 000..197df22
--- /dev/null
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2010 Texas Instruments Incorporated
+ *
+ * Based on da830evm.c. Original Copyrights follow:
+ *
+ * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. nick.thomp...@gefanuc.com
+ * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
+ *
+ * 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 i2c.h
+#include asm/arch/hardware.h
+#include asm/io.h
+#include ../common/misc.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define pinmux davinci_syscfg_regs-pinmux
+
+/* SPI0 pin muxer settings */
+static const struct pinmux_config spi1_pins[] = {
+   { pinmux[5], 1, 1 },
+   { pinmux[5], 1, 2 },
+   { pinmux[5], 1, 4 },
+   { pinmux[5], 1, 5 }
+};
+
+/* UART pin muxer settings */
+static const struct pinmux_config uart_pins[] = {
+   { pinmux[0], 4, 6 },
+   { pinmux[0], 4, 7 },
+   { pinmux[4], 2, 4 },
+   { pinmux[4], 2, 5 }
+};
+
+/* I2C pin muxer settings */
+static const struct pinmux_config i2c_pins[] = {
+   { pinmux[4], 2, 2 },
+   { pinmux[4], 2, 3 }
+};
+
+static const struct