* [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets
@ 2013-04-27 16:58 Alexander Shiyan
2013-04-27 16:58 ` [PATCH 2/2] ARM: Use syslib instead of using private functions Alexander Shiyan
2013-05-08 7:35 ` [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Sascha Hauer
0 siblings, 2 replies; 5+ messages in thread
From: Alexander Shiyan @ 2013-04-27 16:58 UTC (permalink / raw)
To: barebox
This patch moves OMAP syslib functions into common ARM location, so
make these functions available to other ARM targets.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/boards/archosg9/lowlevel.c | 2 +-
arch/arm/boards/beagle/lowlevel.c | 2 +-
arch/arm/boards/beaglebone/board.c | 2 +-
arch/arm/boards/beaglebone/lowlevel.c | 2 +-
arch/arm/boards/omap343xdsp/lowlevel.c | 2 +-
arch/arm/boards/omap3evm/lowlevel.c | 2 +-
arch/arm/boards/panda/board.c | 2 +-
arch/arm/boards/panda/lowlevel.c | 2 +-
arch/arm/boards/pcm049/board.c | 2 +-
arch/arm/boards/pcm049/lowlevel.c | 2 +-
arch/arm/boards/phycard-a-l1/lowlevel.c | 2 +-
arch/arm/boards/phycard-a-xl2/lowlevel.c | 2 +-
arch/arm/boards/phycard-a-xl2/pca-a-xl2.c | 2 +-
arch/arm/include/asm/syslib.h | 47 +++++++++++++++++++++
arch/arm/lib/Makefile | 1 +
arch/arm/lib/syslib.c | 62 +++++++++++++++++++++++++++
arch/arm/mach-omap/Makefile | 3 +-
arch/arm/mach-omap/gpmc.c | 2 +-
arch/arm/mach-omap/include/mach/syslib.h | 53 -----------------------
arch/arm/mach-omap/omap3_clock.c | 2 +-
arch/arm/mach-omap/omap3_generic.c | 2 +-
arch/arm/mach-omap/omap4_clock.c | 2 +-
arch/arm/mach-omap/omap4_generic.c | 2 +-
arch/arm/mach-omap/s32k_clksource.c | 2 +-
arch/arm/mach-omap/syslib.c | 70 -------------------------------
25 files changed, 130 insertions(+), 144 deletions(-)
create mode 100644 arch/arm/include/asm/syslib.h
create mode 100644 arch/arm/lib/syslib.c
delete mode 100644 arch/arm/mach-omap/include/mach/syslib.h
delete mode 100644 arch/arm/mach-omap/syslib.c
diff --git a/arch/arm/boards/archosg9/lowlevel.c b/arch/arm/boards/archosg9/lowlevel.c
index 0334693..123cbec 100644
--- a/arch/arm/boards/archosg9/lowlevel.c
+++ b/arch/arm/boards/archosg9/lowlevel.c
@@ -17,7 +17,7 @@
#include <mach/omap4-mux.h>
#include <mach/omap4-silicon.h>
#include <mach/omap4-clock.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <asm/barebox-arm.h>
#include <asm/barebox-arm-head.h>
#include "mux.h"
diff --git a/arch/arm/boards/beagle/lowlevel.c b/arch/arm/boards/beagle/lowlevel.c
index d0fd066..3295574 100644
--- a/arch/arm/boards/beagle/lowlevel.c
+++ b/arch/arm/boards/beagle/lowlevel.c
@@ -6,7 +6,7 @@
#include <mach/omap3-silicon.h>
#include <mach/omap3-mux.h>
#include <mach/sdrc.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/sys_info.h>
/**
diff --git a/arch/arm/boards/beaglebone/board.c b/arch/arm/boards/beaglebone/board.c
index b3f39ea..b40eb99 100644
--- a/arch/arm/boards/beaglebone/board.c
+++ b/arch/arm/boards/beaglebone/board.c
@@ -36,7 +36,7 @@
#include <mach/am33xx-clock.h>
#include <mach/sdrc.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/gpmc.h>
#include <mach/ehci.h>
#include <i2c/i2c.h>
diff --git a/arch/arm/boards/beaglebone/lowlevel.c b/arch/arm/boards/beaglebone/lowlevel.c
index a9737d9..1fb5563 100644
--- a/arch/arm/boards/beaglebone/lowlevel.c
+++ b/arch/arm/boards/beaglebone/lowlevel.c
@@ -7,7 +7,7 @@
#include <mach/am33xx-clock.h>
#include <mach/sdrc.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/am33xx-mux.h>
#include <mach/wdt.h>
diff --git a/arch/arm/boards/omap343xdsp/lowlevel.c b/arch/arm/boards/omap343xdsp/lowlevel.c
index ed675ad..f50a12d 100644
--- a/arch/arm/boards/omap343xdsp/lowlevel.c
+++ b/arch/arm/boards/omap343xdsp/lowlevel.c
@@ -6,7 +6,7 @@
#include <mach/omap3-mux.h>
#include <mach/sdrc.h>
#include <mach/control.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/omap3-silicon.h>
#include <mach/sys_info.h>
diff --git a/arch/arm/boards/omap3evm/lowlevel.c b/arch/arm/boards/omap3evm/lowlevel.c
index 2d9e130..c79b06c 100644
--- a/arch/arm/boards/omap3evm/lowlevel.c
+++ b/arch/arm/boards/omap3evm/lowlevel.c
@@ -6,7 +6,7 @@
#include <mach/omap3-mux.h>
#include <mach/sdrc.h>
#include <mach/control.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/omap3-silicon.h>
#include <mach/sys_info.h>
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index d1f9a5e..4db7c22 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -10,7 +10,7 @@
#include <mach/omap4-devices.h>
#include <mach/sdrc.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/control.h>
#include <usb/ehci.h>
#include <linux/err.h>
diff --git a/arch/arm/boards/panda/lowlevel.c b/arch/arm/boards/panda/lowlevel.c
index ed1dc6f..ce41b0a 100644
--- a/arch/arm/boards/panda/lowlevel.c
+++ b/arch/arm/boards/panda/lowlevel.c
@@ -22,7 +22,7 @@
#include <mach/omap4-mux.h>
#include <mach/omap4-silicon.h>
#include <mach/omap4-clock.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <asm/barebox-arm.h>
#include <asm/barebox-arm-head.h>
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index b0d689b..ddb6d38 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -26,7 +26,7 @@
#include <mach/omap4-devices.h>
#include <mach/sdrc.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/control.h>
#include <linux/err.h>
#include <sizes.h>
diff --git a/arch/arm/boards/pcm049/lowlevel.c b/arch/arm/boards/pcm049/lowlevel.c
index 5075bbb..b41ec6a 100644
--- a/arch/arm/boards/pcm049/lowlevel.c
+++ b/arch/arm/boards/pcm049/lowlevel.c
@@ -22,7 +22,7 @@
#include <mach/omap4-mux.h>
#include <mach/omap4-silicon.h>
#include <mach/omap4-clock.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <asm/barebox-arm.h>
#include <asm/barebox-arm-head.h>
diff --git a/arch/arm/boards/phycard-a-l1/lowlevel.c b/arch/arm/boards/phycard-a-l1/lowlevel.c
index 30379d8..cacb8e1 100644
--- a/arch/arm/boards/phycard-a-l1/lowlevel.c
+++ b/arch/arm/boards/phycard-a-l1/lowlevel.c
@@ -7,7 +7,7 @@
#include <mach/omap3-mux.h>
#include <mach/sdrc.h>
#include <mach/control.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/omap3-silicon.h>
#include <mach/sys_info.h>
diff --git a/arch/arm/boards/phycard-a-xl2/lowlevel.c b/arch/arm/boards/phycard-a-xl2/lowlevel.c
index 07505ff..a8b5470 100644
--- a/arch/arm/boards/phycard-a-xl2/lowlevel.c
+++ b/arch/arm/boards/phycard-a-xl2/lowlevel.c
@@ -22,7 +22,7 @@
#include <mach/omap4-mux.h>
#include <mach/omap4-silicon.h>
#include <mach/omap4-clock.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <asm/barebox-arm.h>
#include <asm/barebox-arm-head.h>
diff --git a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
index 8f79d98..3eb635a 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -25,7 +25,7 @@
#include <mach/omap4-silicon.h>
#include <mach/sdrc.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/control.h>
#include <linux/err.h>
#include <sizes.h>
diff --git a/arch/arm/include/asm/syslib.h b/arch/arm/include/asm/syslib.h
new file mode 100644
index 0000000..fff89fe
--- /dev/null
+++ b/arch/arm/include/asm/syslib.h
@@ -0,0 +1,47 @@
+/**
+ * @file
+ * @brief ARM independent support functions
+ *
+ * Originally from http://linux.omap.com/pub/bootloader/3430sdp/u-boot-v1.tar.gz
+ *
+ * (C) Copyright 2004-2008
+ * Texas Instruments, <www.ti.com>
+ * Richard Woodruff <r-woodruff2@ti.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.
+ */
+
+#ifndef __ASM_SYSLIB_H_
+#define __ASM_SYSLIB_H_
+
+#include <io.h>
+
+/** System Independent functions */
+
+/**
+ * @brief clear & set a value in a bit range for a 32 bit address
+ *
+ * @param[in] addr Address to set/read from
+ * @param[in] start_bit Where to put the value
+ * @param[in] num_bits number of bits the value should be set
+ * @param[in] value the value to set
+ *
+ * @return void
+ */
+static inline void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
+{
+ u32 tmp, msk = 0;
+ msk = 1 << num_bits;
+ --msk;
+ tmp = readl(addr) & ~(msk << start_bit);
+ tmp |= value << start_bit;
+ writel(tmp, addr);
+}
+
+u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);
+void sdelay(unsigned long loops);
+
+#endif /* __ASM_SYSLIB_H_ */
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 3ea695c..df12f1a 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -17,6 +17,7 @@ obj-y += ashldi3.o
obj-y += lshrdi3.o
obj-y += runtime-offset.o
pbl-y += runtime-offset.o
+lwl-y += syslib.o
obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memcpy.o
obj-$(CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS) += memset.o
obj-$(CONFIG_ARM_UNWIND) += unwind.o
diff --git a/arch/arm/lib/syslib.c b/arch/arm/lib/syslib.c
new file mode 100644
index 0000000..d37d4e7
--- /dev/null
+++ b/arch/arm/lib/syslib.c
@@ -0,0 +1,62 @@
+/**
+ * @file
+ * @brief ARM independent utility APIs
+ *
+ * Provide APIs which can be used from platform/architecture code
+ * to operate on
+ *
+ * Originally from http://linux.omap.com/pub/bootloader/3430sdp/u-boot-v1.tar.gz
+ *
+ * (C) Copyright 2006-2008
+ * Texas Instruments, <www.ti.com>
+ * Richard Woodruff <r-woodruff2@ti.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.
+ */
+
+#include <common.h>
+#include <io.h>
+
+/**
+ * @brief simple spin loop
+ *
+ * Will be constant time as its generally used in bypass conditions only.
+ * This is necessary until timers are accessible. if you need timed delays
+ * use @ref mdelay or @ref udelay instead
+ *
+ * @param[in] loops number of loops
+ *
+ * @return void
+ */
+void sdelay(unsigned long loops)
+{
+ __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
+ "bne 1b":"=r" (loops):"0"(loops));
+}
+
+/**
+ * @brief common routine to allow waiting for changes in volatile regs.
+ *
+ * @param[in] read_bit_mask the bit mask to read
+ * @param[in] match_value match to which value
+ * @param[in] read_addr address to read from
+ * @param[in] bound max iterations
+ *
+ * @return 1 if match_value is found, else if bound iterations reached,
+ * returns 0
+ */
+u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
+{
+ u32 i = 0, val;
+ do {
+ ++i;
+ val = readl(read_addr) & read_bit_mask;
+ if (val == match_value)
+ return 1;
+ if (i == bound)
+ return 0;
+ } while (1);
+}
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index d9e00f7..3e7cffc 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -15,8 +15,7 @@
# GNU General Public License for more details.
#
#
-obj-$(CONFIG_ARCH_OMAP) += syslib.o omap_devices.o omap_generic.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o
+obj-$(CONFIG_ARCH_OMAP) += omap_devices.o omap_generic.o
obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
obj-$(CONFIG_OMAP_CLOCK_SOURCE_DMTIMER0) += dmtimer0.o
obj-$(CONFIG_ARCH_OMAP3) += omap3_generic.o auxcr.o
diff --git a/arch/arm/mach-omap/gpmc.c b/arch/arm/mach-omap/gpmc.c
index bb84b38..d00ff9c 100644
--- a/arch/arm/mach-omap/gpmc.c
+++ b/arch/arm/mach-omap/gpmc.c
@@ -29,7 +29,7 @@
#include <mach/am33xx-silicon.h>
#include <mach/gpmc.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
void __iomem *omap_gpmc_base;
diff --git a/arch/arm/mach-omap/include/mach/syslib.h b/arch/arm/mach-omap/include/mach/syslib.h
deleted file mode 100644
index fe8d71d..0000000
--- a/arch/arm/mach-omap/include/mach/syslib.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * @file
- * @brief These Apis are OMAP independent support functions
- *
- * Implemented by arch/arm/mach-omap/syslib.c
- *
- * Originally from http://linux.omap.com/pub/bootloader/3430sdp/u-boot-v1.tar.gz
- *
- * (C) Copyright 2004-2008
- * Texas Instruments, <www.ti.com>
- * Richard Woodruff <r-woodruff2@ti.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.
- */
-
-#ifndef __ASM_ARCH_OMAP_SYSLIB_H_
-#define __ASM_ARCH_OMAP_SYSLIB_H_
-#include <io.h>
-
-/** System Independent functions */
-
-/**
- * @brief clear & set a value in a bit range for a 32 bit address
- *
- * @param[in] addr Address to set/read from
- * @param[in] start_bit Where to put the value
- * @param[in] num_bits number of bits the value should be set
- * @param[in] value the value to set
- *
- * @return void
- */
-static inline void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
-{
- u32 tmp, msk = 0;
- msk = 1 << num_bits;
- --msk;
- tmp = readl(addr) & ~(msk << start_bit);
- tmp |= value << start_bit;
- writel(tmp, addr);
-}
-
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);
-void sdelay(unsigned long loops);
-
-#endif /* __ASM_ARCH_OMAP_SYSLIB_H_ */
diff --git a/arch/arm/mach-omap/omap3_clock.c b/arch/arm/mach-omap/omap3_clock.c
index bcde48f..21892c6 100644
--- a/arch/arm/mach-omap/omap3_clock.c
+++ b/arch/arm/mach-omap/omap3_clock.c
@@ -37,7 +37,7 @@
#include <mach/omap3-clock.h>
#include <mach/timers.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#define S32K_CR (OMAP3_32KTIMER_BASE + 0x10)
diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c
index 10e03ae..e2d4e44 100644
--- a/arch/arm/mach-omap/omap3_generic.c
+++ b/arch/arm/mach-omap/omap3_generic.c
@@ -39,7 +39,7 @@
#include <mach/omap3-clock.h>
#include <mach/wdt.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/generic.h>
/**
diff --git a/arch/arm/mach-omap/omap4_clock.c b/arch/arm/mach-omap/omap4_clock.c
index 0621fd3..8d0153c 100644
--- a/arch/arm/mach-omap/omap4_clock.c
+++ b/arch/arm/mach-omap/omap4_clock.c
@@ -1,6 +1,6 @@
#include <common.h>
#include <io.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/omap4-silicon.h>
#include <mach/clocks.h>
#include <mach/omap4-clock.h>
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index e1edffa..9d26f97 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -4,7 +4,7 @@
#include <mach/omap4-clock.h>
#include <mach/omap4-silicon.h>
#include <mach/omap4-mux.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
#include <mach/generic.h>
#include <mach/gpmc.h>
#include <mach/gpio.h>
diff --git a/arch/arm/mach-omap/s32k_clksource.c b/arch/arm/mach-omap/s32k_clksource.c
index 7def8b1..0d91227 100644
--- a/arch/arm/mach-omap/s32k_clksource.c
+++ b/arch/arm/mach-omap/s32k_clksource.c
@@ -30,7 +30,7 @@
#include <mach/clocks.h>
#include <mach/timers.h>
#include <mach/sys_info.h>
-#include <mach/syslib.h>
+#include <asm/syslib.h>
/** Sync 32Khz Timer registers */
#define S32K_CR 0x10
diff --git a/arch/arm/mach-omap/syslib.c b/arch/arm/mach-omap/syslib.c
deleted file mode 100644
index 42da348..0000000
--- a/arch/arm/mach-omap/syslib.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @file
- * @brief Provide OMAP independent utility APIs
- *
- * Provide APIs which can be used from platform/architecture code
- * to operate on
- *
- * Originally from http://linux.omap.com/pub/bootloader/3430sdp/u-boot-v1.tar.gz
- *
- * (C) Copyright 2006-2008
- * Texas Instruments, <www.ti.com>
- * Richard Woodruff <r-woodruff2@ti.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.
- */
-
-#include <config.h>
-#include <common.h>
-#include <io.h>
-#include <mach/syslib.h>
-
-/**
- * @brief simple spin loop
- *
- * Will be constant time as its generally used in bypass conditions only.
- * This is necessary until timers are accessible. if you need timed delays
- * use @ref mdelay or @ref udelay instead
- *
- * @param[in] loops number of loops
- *
- * @return void
- */
-void sdelay(unsigned long loops)
-{
- __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
- "bne 1b":"=r" (loops):"0"(loops));
-}
-
-/**
- * @brief common routine to allow waiting for changes in volatile regs.
- *
- * @param[in] read_bit_mask the bit mask to read
- * @param[in] match_value match to which value
- * @param[in] read_addr address to read from
- * @param[in] bound max iterations
- *
- * @return 1 if match_value is found, else if bound iterations reached,
- * returns 0
- */
-u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound)
-{
- u32 i = 0, val;
- do {
- ++i;
- val = readl(read_addr) & read_bit_mask;
- if (val == match_value)
- return 1;
- if (i == bound)
- return 0;
- } while (1);
-}
-
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] ARM: Use syslib instead of using private functions
2013-04-27 16:58 [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Alexander Shiyan
@ 2013-04-27 16:58 ` Alexander Shiyan
2013-05-08 7:35 ` [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Sascha Hauer
1 sibling, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2013-04-27 16:58 UTC (permalink / raw)
To: barebox
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/boards/edb93xx/early_udelay.h | 30 ------------------------------
arch/arm/boards/edb93xx/pll_cfg.c | 4 ++--
arch/arm/boards/edb93xx/sdram_cfg.c | 6 +++---
arch/arm/mach-omap/omap4_generic.c | 10 ++--------
4 files changed, 7 insertions(+), 43 deletions(-)
delete mode 100644 arch/arm/boards/edb93xx/early_udelay.h
diff --git a/arch/arm/boards/edb93xx/early_udelay.h b/arch/arm/boards/edb93xx/early_udelay.h
deleted file mode 100644
index 97e018a..0000000
--- a/arch/arm/boards/edb93xx/early_udelay.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2009 Matthias Kaehlcke <matthias@kaehlcke.net>
- *
- * 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.
- *
- */
-
-#include <common.h>
-
-/* delay execution before timers are initialized */
-static inline void early_udelay(uint32_t usecs)
-{
- /* loop takes 4 cycles at 5.0ns (fastest case, running at 200MHz) */
- register uint32_t loops = usecs * (1000 / 20);
-
- __asm__ volatile ("1:\n"
- "subs %0, %1, #1\n"
- "bne 1b":"=r" (loops):"0" (loops));
-}
diff --git a/arch/arm/boards/edb93xx/pll_cfg.c b/arch/arm/boards/edb93xx/pll_cfg.c
index 9d7e178..95f9fc1 100644
--- a/arch/arm/boards/edb93xx/pll_cfg.c
+++ b/arch/arm/boards/edb93xx/pll_cfg.c
@@ -23,7 +23,7 @@
#include <common.h>
#include <io.h>
#include "pll_cfg.h"
-#include "early_udelay.h"
+#include <asm/syslib.h>
void pll_cfg(void)
{
@@ -50,5 +50,5 @@ void pll_cfg(void)
* the user's guide recommends to wait at least 1 ms for PLL2 to
* stabilize
*/
- early_udelay(1000);
+ sdelay(1000 * (1000 / 20));
}
diff --git a/arch/arm/boards/edb93xx/sdram_cfg.c b/arch/arm/boards/edb93xx/sdram_cfg.c
index 5c2a537..9e8787e 100644
--- a/arch/arm/boards/edb93xx/sdram_cfg.c
+++ b/arch/arm/boards/edb93xx/sdram_cfg.c
@@ -21,7 +21,7 @@
#include <common.h>
#include <io.h>
#include "sdram_cfg.h"
-#include "early_udelay.h"
+#include <asm/syslib.h>
#define PROGRAM_MODE_REG(bank) (*(volatile uint32_t *) \
(SDRAM_BASE_ADDR | SDRAM_BANK_SEL_##bank | SDRAM_MODE_REG_VAL))
@@ -46,7 +46,7 @@ void sdram_cfg(void)
/* Issue continous NOP commands */
writel(GLCONFIG_INIT | GLCONFIG_MRS | GLCONFIG_CKE, &sdram->glconfig);
- early_udelay(200);
+ sdelay(200 * (1000 / 20));
precharge_all_banks();
@@ -102,7 +102,7 @@ static void setup_refresh_timer(void)
* Wait at least 80 clock cycles to provide 8 refresh cycles
* to all SDRAMs
*/
- early_udelay(1);
+ sdelay(1 * (1000 / 20));
/*
* Program refresh timer with normal value
diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c
index 9d26f97..a73a722 100644
--- a/arch/arm/mach-omap/omap4_generic.c
+++ b/arch/arm/mach-omap/omap4_generic.c
@@ -152,12 +152,6 @@ static void wait_for_command_complete(void)
#define CS1_MR(mr) ((mr) | 0x80000000)
-static inline void delay(unsigned long loops)
-{
- __asm__ volatile ("1:\n" "subs %0, %1, #1\n"
- "bne 1b" : "=r" (loops) : "0"(loops));
-}
-
int omap4_emif_config(unsigned int base, const struct ddr_regs *ddr_regs)
{
/*
@@ -229,7 +223,7 @@ int omap4_emif_config(unsigned int base, const struct ddr_regs *ddr_regs)
writel(MR10_ZQINIT, base + EMIF_LPDDR2_MODE_REG_DATA);
/* wait for tZQINIT=1us */
- delay(10);
+ sdelay(10);
/* set MR1 register */
writel(MR1_ADDR, base + EMIF_LPDDR2_MODE_REG_CFG);
@@ -329,7 +323,7 @@ void omap4_ddr_init(const struct ddr_regs *ddr_regs,
/* Set DLL_OVERRIDE = 0 */
writel(0x0, CM_DLL_CTRL);
- delay(200);
+ sdelay(200);
/* Check for DDR PHY ready for EMIF1 & EMIF2 */
while (((readl(OMAP44XX_EMIF1_BASE + EMIF_STATUS) & 0x04) != 0x04) \
--
1.8.1.5
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets
2013-04-27 16:58 [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Alexander Shiyan
2013-04-27 16:58 ` [PATCH 2/2] ARM: Use syslib instead of using private functions Alexander Shiyan
@ 2013-05-08 7:35 ` Sascha Hauer
2013-05-08 7:42 ` Re[2]: " Alexander Shiyan
1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2013-05-08 7:35 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Sat, Apr 27, 2013 at 08:58:54PM +0400, Alexander Shiyan wrote:
> This patch moves OMAP syslib functions into common ARM location, so
> make these functions available to other ARM targets.
>
> +/**
> + * @brief clear & set a value in a bit range for a 32 bit address
> + *
> + * @param[in] addr Address to set/read from
> + * @param[in] start_bit Where to put the value
> + * @param[in] num_bits number of bits the value should be set
> + * @param[in] value the value to set
> + *
> + * @return void
> + */
> +static inline void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
> +{
> + u32 tmp, msk = 0;
> + msk = 1 << num_bits;
> + --msk;
> + tmp = readl(addr) & ~(msk << start_bit);
> + tmp |= value << start_bit;
> + writel(tmp, addr);
> +}
> +
> +u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);
I'm still undecided on this. On one hand it's good to have common
functions for these jobs, but on the other hand I'm not sure these are
the versions we should use as the definite answer to the problem. I
don't know how many versions of read-modify-write functions are around,
but there are many.
> +void sdelay(unsigned long loops);
The sdelay change is a good one, though I think this should be a static
inline function.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re[2]: [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets
2013-05-08 7:35 ` [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Sascha Hauer
@ 2013-05-08 7:42 ` Alexander Shiyan
2013-05-08 19:57 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Shiyan @ 2013-05-08 7:42 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
> On Sat, Apr 27, 2013 at 08:58:54PM +0400, Alexander Shiyan wrote:
> > This patch moves OMAP syslib functions into common ARM location, so
> > make these functions available to other ARM targets.
> >
> > +/**
> > + * @brief clear & set a value in a bit range for a 32 bit address
> > + *
> > + * @param[in] addr Address to set/read from
> > + * @param[in] start_bit Where to put the value
> > + * @param[in] num_bits number of bits the value should be set
> > + * @param[in] value the value to set
> > + *
> > + * @return void
> > + */
> > +static inline void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
> > +{
> > + u32 tmp, msk = 0;
> > + msk = 1 << num_bits;
> > + --msk;
> > + tmp = readl(addr) & ~(msk << start_bit);
> > + tmp |= value << start_bit;
> > + writel(tmp, addr);
> > +}
> > +
> > +u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);
>
> I'm still undecided on this. On one hand it's good to have common
> functions for these jobs, but on the other hand I'm not sure these are
> the versions we should use as the definite answer to the problem. I
> don't know how many versions of read-modify-write functions are around,
> but there are many.
>
> > +void sdelay(unsigned long loops);
>
> The sdelay change is a good one, though I think this should be a static
> inline function.
The U-Boot contain followed note about this inline:
/************************************************************
* sdelay() - simple spin loop. Will be constant time as
* its generally used in bypass conditions only. This
* is necessary until timers are accessible.
*
* not inline to increase chances its in cache when called
*************************************************************/
So...
---
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets
2013-05-08 7:42 ` Re[2]: " Alexander Shiyan
@ 2013-05-08 19:57 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2013-05-08 19:57 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Wed, May 08, 2013 at 11:42:50AM +0400, Alexander Shiyan wrote:
> > On Sat, Apr 27, 2013 at 08:58:54PM +0400, Alexander Shiyan wrote:
> > > This patch moves OMAP syslib functions into common ARM location, so
> > > make these functions available to other ARM targets.
> > >
> > > +/**
> > > + * @brief clear & set a value in a bit range for a 32 bit address
> > > + *
> > > + * @param[in] addr Address to set/read from
> > > + * @param[in] start_bit Where to put the value
> > > + * @param[in] num_bits number of bits the value should be set
> > > + * @param[in] value the value to set
> > > + *
> > > + * @return void
> > > + */
> > > +static inline void sr32(u32 addr, u32 start_bit, u32 num_bits, u32 value)
> > > +{
> > > + u32 tmp, msk = 0;
> > > + msk = 1 << num_bits;
> > > + --msk;
> > > + tmp = readl(addr) & ~(msk << start_bit);
> > > + tmp |= value << start_bit;
> > > + writel(tmp, addr);
> > > +}
> > > +
> > > +u32 wait_on_value(u32 read_bit_mask, u32 match_value, u32 read_addr, u32 bound);
> >
> > I'm still undecided on this. On one hand it's good to have common
> > functions for these jobs, but on the other hand I'm not sure these are
> > the versions we should use as the definite answer to the problem. I
> > don't know how many versions of read-modify-write functions are around,
> > but there are many.
> >
> > > +void sdelay(unsigned long loops);
> >
> > The sdelay change is a good one, though I think this should be a static
> > inline function.
>
> The U-Boot contain followed note about this inline:
>
> /************************************************************
> * sdelay() - simple spin loop. Will be constant time as
> * its generally used in bypass conditions only. This
> * is necessary until timers are accessible.
> *
> * not inline to increase chances its in cache when called
I have no idea what difference this should make. After the first
iteration of the loop the code is in cache.
When the code is not in the cache the loop maybe takes a bit longer, but
that's ok.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-08 19:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-27 16:58 [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Alexander Shiyan
2013-04-27 16:58 ` [PATCH 2/2] ARM: Use syslib instead of using private functions Alexander Shiyan
2013-05-08 7:35 ` [PATCH 1/2] ARM: Make OMAP syslib.c functions available for other ARM targets Sascha Hauer
2013-05-08 7:42 ` Re[2]: " Alexander Shiyan
2013-05-08 19:57 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox