OMAP3: Move get_device_type() function to not duplicate code
authorEnric Balletbo i Serra <eballetbo@gmail.com>
Wed, 25 May 2011 07:37:22 +0000 (09:37 +0200)
committerAnand Gadiyar <gadiyar@ti.com>
Thu, 14 Jul 2011 12:10:48 +0000 (17:40 +0530)
The get_device_type() function is implemented by various boards, this
patch moves this function to a common place to not duplicate code.

 board/omap3530beagle/omap3530beagle.c:97:u32 get_device_type(void)
 board/igep00x0/igep00x0.c            :90:u32 get_device_type(void)
 board/omap3430sdp/omap3430sdp.c      :82:u32 get_device_type(void)
 board/omap3evm/omap3evm.c            :84:u32 get_device_type(void)
 board/omap3430labrador/omap3430sdp.c :79:u32 get_device_type(void)
 board/overo/overo.c                  :105:u32 get_device_type(void)

Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
board/igep00x0/igep00x0.c
board/omap3430labrador/omap3430sdp.c
board/omap3430sdp/omap3430sdp.c
board/omap3530beagle/omap3530beagle.c
board/omap3evm/omap3evm.c
board/overo/overo.c
cpu/omap3/Makefile
cpu/omap3/sys_info.c [new file with mode: 0644]

index b794abb..1666337 100644 (file)
@@ -84,16 +84,6 @@ void udelay (unsigned long usecs) {
        delay(usecs);
 }
 
-/*************************************************************
- *  get_device_type(): tell if GP/HS/EMU/TST
- *************************************************************/
-u32 get_device_type(void)
-{
-       int mode;
-       mode = __raw_readl(CONTROL_STATUS) & (DEVICE_MASK);
-       return mode >>= 8;
-}
-
 /*************************************************************
  * Routine: get_mem_type(void) - returns the kind of memory connected
  * to GPMC that we are trying to boot form. Uses SYS BOOT settings.
index 89d9ff1..0312d66 100644 (file)
@@ -73,16 +73,6 @@ int board_init (void)
        return 0;
 }
 
-/*************************************************************
- *  get_device_type(): tell if GP/HS/EMU/TST
- *************************************************************/
-u32 get_device_type(void)
-{
-        int mode;
-        mode = __raw_readl(CONTROL_STATUS) & (DEVICE_MASK);
-        return(mode >>= 8);
-}
-
 /******************************************
  * get_cpu_rev(void) - extract version info
  ******************************************/
index 6ed62bc..7cb45bb 100644 (file)
@@ -76,16 +76,6 @@ int board_init (void)
        return 0;
 }
 
-/*************************************************************
- *  get_device_type(): tell if GP/HS/EMU/TST
- *************************************************************/
-u32 get_device_type(void)
-{
-        int mode;
-        mode = __raw_readl(CONTROL_STATUS) & (DEVICE_MASK);
-        return(mode >>= 8);
-}
-
 /******************************************
  * get_cpu_rev(void) - extract version info
  ******************************************/
index 15943f5..0402a57 100644 (file)
@@ -91,16 +91,6 @@ int board_init(void)
        return 0;
 }
 
-/*************************************************************
- *  get_device_type(): tell if GP/HS/EMU/TST
- *************************************************************/
-u32 get_device_type(void)
-{
-       int mode;
-       mode = __raw_readl(CONTROL_STATUS) & (DEVICE_MASK);
-       return mode >>= 8;
-}
-
 /************************************************
  * get_sysboot_value(void) - return SYS_BOOT[4:0]
  ************************************************/
index 16c1f70..4f1fedd 100644 (file)
@@ -78,16 +78,6 @@ int board_init (void)
        return 0;
 }
 
-/*************************************************************
- *  get_device_type(): tell if GP/HS/EMU/TST
- *************************************************************/
-u32 get_device_type(void)
-{
-        int mode;
-        mode = __raw_readl(CONTROL_STATUS) & (DEVICE_MASK);
-        return(mode >>= 8);
-}
-
 /************************************************
  * get_sysboot_value(void) - return SYS_BOOT[4:0]
  ************************************************/
index b2c536a..b942c5b 100644 (file)
@@ -99,16 +99,6 @@ int board_init(void)
        return 0;
 }
 
-/*************************************************************
- *  get_device_type(): tell if GP/HS/EMU/TST
- *************************************************************/
-u32 get_device_type(void)
-{
-       int mode;
-       mode = __raw_readl(CONTROL_STATUS) & (DEVICE_MASK);
-       return mode >>= 8;
-}
-
 /************************************************
  * get_sysboot_value(void) - return SYS_BOOT[4:0]
  ************************************************/
index 678619c..eba6987 100644 (file)
@@ -26,7 +26,7 @@ include $(TOPDIR)/config.mk
 LIB    = $(obj)lib$(CPU).a
 
 START  = start.o
-COBJS  = cpu.o mmc.o gpio.o
+COBJS  = cpu.o mmc.o gpio.o sys_info.o
 
 SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
diff --git a/cpu/omap3/sys_info.c b/cpu/omap3/sys_info.c
new file mode 100644 (file)
index 0000000..f6cb65f
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/bits.h>
+#include <asm/arch/sys_proto.h>
+#include <asm/arch/sys_info.h>
+
+/*
+ *  get_device_type(): tell if GP/HS/EMU/TST
+ */
+u32 get_device_type(void)
+{
+       int mode;
+       mode = __raw_readl(CONTROL_STATUS) & (DEVICE_MASK);
+       return mode >>= 8;
+}