Re: [U-Boot-Users] [PATCH 3/4] ARM DaVinci: Move common functions to board/davinci/common

2008-08-27 Thread Jean-Christophe PLAGNIOL-VILLARD
On 15:10 Fri 11 Jul , Hugo Villeneuve wrote:
 ARM DaVinci: Move common functions to board/davinci/common.
 
 Signed-off-by: Hugo Villeneuve [EMAIL PROTECTED]
 
 ---
 
  board/davinci/common/Makefile  |   53 
  board/davinci/common/misc.c|  126 
  board/davinci/common/misc.h|   32 +++
  board/davinci/common/psc.c |  117 ++
  board/davinci/common/psc.h |   28 +++
  board/davinci/dv-evm/dv_board.c|  129 --
  board/davinci/schmoogie/dv_board.c |  103 ++-
  board/davinci/sffsdr/sffsdr.c  |  158 
 
  board/davinci/sonata/dv_board.c|  122 +++-
  9 files changed, 404 insertions(+), 464 deletions(-)
 
Applied to u-boot-arm

Best Regards,
J.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH 3/4] ARM DaVinci: Move common functions to board/davinci/common

2008-07-11 Thread Hugo Villeneuve
ARM DaVinci: Move common functions to board/davinci/common.

Signed-off-by: Hugo Villeneuve [EMAIL PROTECTED]

---

 board/davinci/common/Makefile  |   53 
 board/davinci/common/misc.c|  126 
 board/davinci/common/misc.h|   32 +++
 board/davinci/common/psc.c |  117 ++
 board/davinci/common/psc.h |   28 +++
 board/davinci/dv-evm/dv_board.c|  129 --
 board/davinci/schmoogie/dv_board.c |  103 ++-
 board/davinci/sffsdr/sffsdr.c  |  158 
 board/davinci/sonata/dv_board.c|  122 +++-
 9 files changed, 404 insertions(+), 464 deletions(-)

diff --git a/board/davinci/common/Makefile b/board/davinci/common/Makefile
new file mode 100644
index 000..127bb6e
--- /dev/null
+++ b/board/davinci/common/Makefile
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2006
+# Wolfgang Denk, DENX Software Engineering, [EMAIL PROTECTED]
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)board/$(VENDOR)/common)
+endif
+
+LIB= $(obj)lib$(VENDOR).a
+
+COBJS  := psc.o misc.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS)
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+# This is for $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/davinci/common/misc.c b/board/davinci/common/misc.c
new file mode 100644
index 000..71a3b87
--- /dev/null
+++ b/board/davinci/common/misc.c
@@ -0,0 +1,126 @@
+/*
+ * Miscelaneous DaVinci functions.
+ *
+ * Copyright (C) 2007 Sergey Kubushyn [EMAIL PROTECTED]
+ * Copyright (C) 2008 Lyrtech www.lyrtech.com
+ * Copyright (C) 2004 Texas Instruments.
+ *
+ * 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 i2c.h
+#include asm/arch/hardware.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+   gd-bd-bi_dram[0].start = PHYS_SDRAM_1;
+   gd-bd-bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+   return(0);
+}
+
+static int dv_get_pllm_output(uint32_t pllm)
+{
+   return (pllm + 1) * (CFG_HZ_CLOCK / 100);
+}
+
+void dv_display_clk_infos(void)
+{
+   printf(ARM Clock: %dMHz\n, dv_get_pllm_output(REG(PLL1_PLLM)) / 2);
+   printf(DDR Clock: %dMHz\n, dv_get_pllm_output(REG(PLL2_PLLM)) /
+  ((REG(PLL2_DIV2)  0x1f) + 1) / 2);
+}
+
+/* Read ethernet MAC address from EEPROM for DVEVM compatible boards.
+ * Returns 1 if found, 0 otherwise.
+ */
+int dvevm_read_mac_address(uint8_t *buf)
+{
+#ifdef CFG_I2C_EEPROM_ADDR
+   /* Read MAC address. */
+   if (i2c_read(CFG_I2C_EEPROM_ADDR, 0x7F00, CFG_I2C_EEPROM_ADDR_LEN,
+(uint8_t *) buf[0], 6))
+   goto i2cerr;
+
+   /* Check that MAC address is not null. */
+   if (memcmp(buf, \0\0\0\0\0\0, 6) == 0)
+   goto err;
+
+   return 1; /* Found */
+
+i2cerr:
+   printf(Read from EEPROM @ 0x%02x failed\n, CFG_I2C_EEPROM_ADDR);
+err:
+#endif /* CFG_I2C_EEPROM_ADDR */