[U-Boot] [PATCH 3/5] MSM 7x27a: Add support for qualcomm msm7x27a surf board

2012-08-13 Thread Srikanth Reddy Vintha
Signed-off-by: Srikanth Reddy Vintha srikanth.re...@lntinfotech.com
---
 board/qcom/msm7x27a_surf/Makefile|   56 +
 board/qcom/msm7x27a_surf/msm7x27a_surf.c |  126 +
 board/qcom/msm7x27a_surf/msm7x27a_surf.h |   27 ++
 boards.cfg   |1 +
 include/configs/msm7x27a_surf.h  |  128 ++
 5 files changed, 338 insertions(+), 0 deletions(-)
 create mode 100644 board/qcom/msm7x27a_surf/Makefile
 create mode 100644 board/qcom/msm7x27a_surf/msm7x27a_surf.c
 create mode 100644 board/qcom/msm7x27a_surf/msm7x27a_surf.h
 create mode 100644 include/configs/msm7x27a_surf.h

diff --git a/board/qcom/msm7x27a_surf/Makefile 
b/board/qcom/msm7x27a_surf/Makefile
new file mode 100644
index 000..123099d
--- /dev/null
+++ b/board/qcom/msm7x27a_surf/Makefile
@@ -0,0 +1,56 @@
+#
+#  (C) Copyright 2012
+#  Larsen  Toubro Infotech Ltd. www.lntinfotech.com
+#
+#  (C) Copyright 2010,2011
+#  NVIDIA Corporation www.nvidia.com
+#
+#
+#  See file CREDITS for list of people who contributed to this
+#  project.
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License as
+#  published by the Free Software Foundation; either version 2 of
+#  the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+#  MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../../qcom/msm7x27a_surf/)
+endif
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+clean:
+   rm -f $(OBJS)
+
+distclean:
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/qcom/msm7x27a_surf/msm7x27a_surf.c 
b/board/qcom/msm7x27a_surf/msm7x27a_surf.c
new file mode 100644
index 000..9199f48
--- /dev/null
+++ b/board/qcom/msm7x27a_surf/msm7x27a_surf.c
@@ -0,0 +1,126 @@
+/*
+ * (C) Copyright 2012
+ * Larsen  Toubro Infotech Ltd. www.lntinfotech.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include common.h
+#include asm/arch/iomap.h
+#include asm/arch/sys_proto.h
+#include asm/io.h
+#include malloc.h
+#include asm/arch/mmc.h
+#include linux/string.h
+#include asm/mach-types.h
+#include asm/arch/proc_comm.h
+#include msm7x27a_surf.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f()
+{
+   uart1_clock_init();
+   return 0;
+}
+#endif
+int board_init()
+{
+   unsigned long new_addr;
+   unsigned long offset;
+   offset = gd-relocaddr - CONFIG_SYS_TEXT_BASE;
+   new_addr = CONFIG_SYS_TEXT_BASE + offset;
+   set_vector_base(new_addr);
+   acpu_clock_init();
+   bd_t *bd = gd-bd;
+   bd-bi_arch_number = MACH_TYPE_MSM7X27_SURF;
+   return 0;
+}
+
+#ifdef CONFIG_QC_MMC
+
+/* called during the scan of each mmc device */
+int qc_board_mmc_init(struct mmc *mmc)
+{
+
+   struct mmc_priv *sd = (struct mmc_priv *)mmc-priv;
+   u32 smem_val;
+   do {
+   smem_val = 0;
+   smem_val = readl(MSM_SHARED_BASE + 0x14);
+   } while (smem_val != 1);
+
+   if (sd-instance == 3 || sd-instance == 4) {
+   mmc_boot_main(mmc);
+   return 0;
+   } else
+   /* this board does not have an sd/mmc card on this interface. */
+   return 1;
+   }
+int board_mmc_init(bd_t *bis)
+{
+#ifdef QC_SD
+   struct mmc *mmc_4;
+   struct mmc_priv *sdcc_4;
+   mmc_4 = (struct mmc 

[U-Boot] [PATCH 3/5] MSM 7x27a: Add support for qualcomm msm7x27a surf board

2012-08-13 Thread Srikanth Reddy Vintha
Signed-off-by: Srikanth Reddy Vintha srikanth.re...@lntinfotech.com
---
 board/qcom/msm7x27a_surf/Makefile|   56 +
 board/qcom/msm7x27a_surf/msm7x27a_surf.c |  126 +
 board/qcom/msm7x27a_surf/msm7x27a_surf.h |   27 ++
 boards.cfg   |1 +
 include/configs/msm7x27a_surf.h  |  128 ++
 5 files changed, 338 insertions(+), 0 deletions(-)
 create mode 100644 board/qcom/msm7x27a_surf/Makefile
 create mode 100644 board/qcom/msm7x27a_surf/msm7x27a_surf.c
 create mode 100644 board/qcom/msm7x27a_surf/msm7x27a_surf.h
 create mode 100644 include/configs/msm7x27a_surf.h

diff --git a/board/qcom/msm7x27a_surf/Makefile 
b/board/qcom/msm7x27a_surf/Makefile
new file mode 100644
index 000..123099d
--- /dev/null
+++ b/board/qcom/msm7x27a_surf/Makefile
@@ -0,0 +1,56 @@
+#
+#  (C) Copyright 2012
+#  Larsen  Toubro Infotech Ltd. www.lntinfotech.com
+#
+#  (C) Copyright 2010,2011
+#  NVIDIA Corporation www.nvidia.com
+#
+#
+#  See file CREDITS for list of people who contributed to this
+#  project.
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License as
+#  published by the Free Software Foundation; either version 2 of
+#  the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+#  MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+ifneq ($(OBJTREE),$(SRCTREE))
+$(shell mkdir -p $(obj)../../qcom/msm7x27a_surf/)
+endif
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := $(BOARD).o
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+clean:
+   rm -f $(OBJS)
+
+distclean:
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/qcom/msm7x27a_surf/msm7x27a_surf.c 
b/board/qcom/msm7x27a_surf/msm7x27a_surf.c
new file mode 100644
index 000..9199f48
--- /dev/null
+++ b/board/qcom/msm7x27a_surf/msm7x27a_surf.c
@@ -0,0 +1,126 @@
+/*
+ * (C) Copyright 2012
+ * Larsen  Toubro Infotech Ltd. www.lntinfotech.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include common.h
+#include asm/arch/iomap.h
+#include asm/arch/sys_proto.h
+#include asm/io.h
+#include malloc.h
+#include asm/arch/mmc.h
+#include linux/string.h
+#include asm/mach-types.h
+#include asm/arch/proc_comm.h
+#include msm7x27a_surf.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f()
+{
+   uart1_clock_init();
+   return 0;
+}
+#endif
+int board_init()
+{
+   unsigned long new_addr;
+   unsigned long offset;
+   offset = gd-relocaddr - CONFIG_SYS_TEXT_BASE;
+   new_addr = CONFIG_SYS_TEXT_BASE + offset;
+   set_vector_base(new_addr);
+   acpu_clock_init();
+   bd_t *bd = gd-bd;
+   bd-bi_arch_number = MACH_TYPE_MSM7X27_SURF;
+   return 0;
+}
+
+#ifdef CONFIG_QC_MMC
+
+/* called during the scan of each mmc device */
+int qc_board_mmc_init(struct mmc *mmc)
+{
+
+   struct mmc_priv *sd = (struct mmc_priv *)mmc-priv;
+   u32 smem_val;
+   do {
+   smem_val = 0;
+   smem_val = readl(MSM_SHARED_BASE + 0x14);
+   } while (smem_val != 1);
+
+   if (sd-instance == 3 || sd-instance == 4) {
+   mmc_boot_main(mmc);
+   return 0;
+   } else
+   /* this board does not have an sd/mmc card on this interface. */
+   return 1;
+   }
+int board_mmc_init(bd_t *bis)
+{
+#ifdef QC_SD
+   struct mmc *mmc_4;
+   struct mmc_priv *sdcc_4;
+   mmc_4 = (struct mmc