From: Enric Balletbo i Serra Date: Wed, 25 May 2011 07:37:22 +0000 (+0200) Subject: OMAP3: Move get_device_type() function to not duplicate code X-Git-Tag: v1.5.1~13 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e27c80c04e518ceb411e67f2e3d6b20f1794c636;p=pandora-x-loader.git OMAP3: Move get_device_type() function to not duplicate code 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 Signed-off-by: Anand Gadiyar --- diff --git a/board/igep00x0/igep00x0.c b/board/igep00x0/igep00x0.c index b794abb..1666337 100644 --- a/board/igep00x0/igep00x0.c +++ b/board/igep00x0/igep00x0.c @@ -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. diff --git a/board/omap3430labrador/omap3430sdp.c b/board/omap3430labrador/omap3430sdp.c index 89d9ff1..0312d66 100644 --- a/board/omap3430labrador/omap3430sdp.c +++ b/board/omap3430labrador/omap3430sdp.c @@ -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 ******************************************/ diff --git a/board/omap3430sdp/omap3430sdp.c b/board/omap3430sdp/omap3430sdp.c index 6ed62bc..7cb45bb 100644 --- a/board/omap3430sdp/omap3430sdp.c +++ b/board/omap3430sdp/omap3430sdp.c @@ -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 ******************************************/ diff --git a/board/omap3530beagle/omap3530beagle.c b/board/omap3530beagle/omap3530beagle.c index 15943f5..0402a57 100644 --- a/board/omap3530beagle/omap3530beagle.c +++ b/board/omap3530beagle/omap3530beagle.c @@ -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] ************************************************/ diff --git a/board/omap3evm/omap3evm.c b/board/omap3evm/omap3evm.c index 16c1f70..4f1fedd 100644 --- a/board/omap3evm/omap3evm.c +++ b/board/omap3evm/omap3evm.c @@ -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] ************************************************/ diff --git a/board/overo/overo.c b/board/overo/overo.c index b2c536a..b942c5b 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -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] ************************************************/ diff --git a/cpu/omap3/Makefile b/cpu/omap3/Makefile index 678619c..eba6987 100644 --- a/cpu/omap3/Makefile +++ b/cpu/omap3/Makefile @@ -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 index 0000000..f6cb65f --- /dev/null +++ b/cpu/omap3/sys_info.c @@ -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 +#include +#include +#include +#include + +/* + * 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; +}