[U-Boot] [U-boot] [Patch v2 5/6] keystone2: move cpu_to_bus() to keystone.c

Ivan Khoronzhuk ivan.khoronzhuk at ti.com
Wed Jul 9 18:48:43 CEST 2014


From: Hao Zhang <hzhang at ti.com>

The SoC related common functions in board.c should be placed to
a common keystone.c arch file.

Acked-by: Murali Karicheri <m-maricheri2 at ti.com>
Signed-off-by: Hao Zhang <hzhang at ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk at ti.com>
---
 arch/arm/cpu/armv7/keystone/Makefile   |  1 +
 arch/arm/cpu/armv7/keystone/keystone.c | 28 ++++++++++++++++++++++++++++
 board/ti/k2hk_evm/board.c              | 14 --------------
 3 files changed, 29 insertions(+), 14 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/keystone/keystone.c

diff --git a/arch/arm/cpu/armv7/keystone/Makefile b/arch/arm/cpu/armv7/keystone/Makefile
index 02ecf7e..64e42a6 100644
--- a/arch/arm/cpu/armv7/keystone/Makefile
+++ b/arch/arm/cpu/armv7/keystone/Makefile
@@ -14,3 +14,4 @@ obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_nav.o
 obj-y	+= msmc.o
 obj-$(CONFIG_SPL_BUILD)	+= spl.o
 obj-y	+= ddr3.o
+obj-y	+= keystone.o
diff --git a/arch/arm/cpu/armv7/keystone/keystone.c b/arch/arm/cpu/armv7/keystone/keystone.c
new file mode 100644
index 0000000..48c8690
--- /dev/null
+++ b/arch/arm/cpu/armv7/keystone/keystone.c
@@ -0,0 +1,28 @@
+/*
+ * Keystone EVM : Board initialization
+ *
+ * (C) Copyright 2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+
+/**
+ * cpu_to_bus - swap bytes of the 32-bit data if the device is BE
+ * @ptr - array of data
+ * @length - lenght of data array
+ */
+int cpu_to_bus(u32 *ptr, u32 length)
+{
+	u32 i;
+
+	if (!(readl(K2HK_DEVSTAT) & 0x1))
+		for (i = 0; i < length; i++, ptr++)
+			*ptr = cpu_to_be32(*ptr);
+
+	return 0;
+}
diff --git a/board/ti/k2hk_evm/board.c b/board/ti/k2hk_evm/board.c
index f910ebe..3333eb0 100644
--- a/board/ti/k2hk_evm/board.c
+++ b/board/ti/k2hk_evm/board.c
@@ -23,8 +23,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-u32 device_big_endian;
-
 unsigned int external_clk[ext_clk_count] = {
 	[sys_clk]	=	122880000,
 	[alt_core_clk]	=	125000000,
@@ -136,18 +134,6 @@ int board_eth_init(bd_t *bis)
 }
 #endif
 
-/* Byte swap the 32-bit data if the device is BE */
-int cpu_to_bus(u32 *ptr, u32 length)
-{
-	u32 i;
-
-	if (device_big_endian)
-		for (i = 0; i < length; i++, ptr++)
-			*ptr = __swab32(*ptr);
-
-	return 0;
-}
-
 #if defined(CONFIG_BOARD_EARLY_INIT_F)
 int board_early_init_f(void)
 {
-- 
1.8.3.2



More information about the U-Boot mailing list