ARM: Make OMAP syslib.c functions available for other ARM targets
Subsystems (5)
PATCH 1/2 ARM: Make OMAP syslib.c functions available for other ARM targets
This patch moves OMAP syslib functions into common ARM location, so make these functions available to other ARM targets.
--- 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
arch/arm/boards/archosg9/lowlevel.c +1 -1
@@ -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"
arch/arm/boards/beagle/lowlevel.c +1 -1
@@ -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> /**
arch/arm/boards/beaglebone/board.c +1 -1
@@ -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>
arch/arm/boards/beaglebone/lowlevel.c +1 -1
@@ -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>
arch/arm/boards/omap343xdsp/lowlevel.c +1 -1
@@ -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>
arch/arm/boards/omap3evm/lowlevel.c +1 -1
@@ -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>
arch/arm/boards/panda/board.c +1 -1
@@ -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>
arch/arm/boards/panda/lowlevel.c +1 -1
@@ -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>
arch/arm/boards/pcm049/board.c +1 -1
@@ -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>
arch/arm/boards/pcm049/lowlevel.c +1 -1
@@ -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>
arch/arm/boards/phycard-a-l1/lowlevel.c +1 -1
@@ -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>
arch/arm/boards/phycard-a-xl2/lowlevel.c +1 -1
@@ -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>
arch/arm/boards/phycard-a-xl2/pca-a-xl2.c +1 -1
@@ -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>
arch/arm/include/asm/syslib.h new file +47 -0
47 lines not on this page · raw message
arch/arm/lib/Makefile +1 -0
@@ -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
arch/arm/lib/syslib.c new file +62 -0
62 lines not on this page · raw message
arch/arm/mach-omap/Makefile +1 -2
@@ -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
arch/arm/mach-omap/gpmc.c +1 -1
@@ -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;
arch/arm/mach-omap/include/mach/syslib.h deleted +0 -53
53 lines not on this page · raw message
arch/arm/mach-omap/omap3_clock.c +1 -1
@@ -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)
arch/arm/mach-omap/omap3_generic.c +1 -1
@@ -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> /**
arch/arm/mach-omap/omap4_clock.c +1 -1
@@ -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>
arch/arm/mach-omap/omap4_generic.c +1 -1
@@ -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>
arch/arm/mach-omap/s32k_clksource.c +1 -1
@@ -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
arch/arm/mach-omap/syslib.c deleted +0 -70
70 lines not on this page · raw message
Signature · 7 lines
1.8.1.5 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/2 ARM: Use syslib instead of using private functions
--- 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
arch/arm/boards/edb93xx/early_udelay.h deleted +0 -30
@@ -1,30 +0,0 @@ -/* -* Copyright (C) 2009 Matthias Kaehlcke <[email protected]> -* -* 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) */ - registeruint32_t loops = usecs * (1000 /20 ); - - __asm__volatile ("1:\n" -"subs %0, %1, #1\n" -"bne 1b" :"=r" (loops):"0" (loops)); -}
arch/arm/boards/edb93xx/pll_cfg.c +2 -2
@@ -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 )); }
arch/arm/boards/edb93xx/sdram_cfg.c +3 -3
@@ -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
arch/arm/mach-omap/omap4_generic.c +2 -8
@@ -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) \
Signature · 7 lines
1.8.1.5 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 14 lines · Alexander Shiyan
This patch moves OMAP syslib functions into common ARM location, so make these functions available to other ARM targets.
arch/arm/include/asm/syslib.h new file +11
-0+/** +* @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)
arch/arm/include/asm/syslib.h line 44
Quoted 10 lines
arch/arm/include/asm/syslib.h new file +10
-0+{ +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.
Quoted 1 line
+void sdelay(unsigned long loops);
The sdelay change is a good one, though I think this should be a static inline function.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 32 lines · Alexander Shiyan
Quoted 14 lines
This patch moves OMAP syslib functions into common ARM location, so make these functions available to other ARM targets.
arch/arm/include/asm/syslib.h new file +11
-0+/** +* @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)arch/arm/include/asm/syslib.h line 44
Quoted 10 lines
arch/arm/include/asm/syslib.h new file +10
-0+{ +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.
Quoted 4 lines
Quoted 1 line
+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
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 37 lines · Alexander Shiyan
Quoted 32 lines · Alexander Shiyan
Quoted 14 lines
This patch moves OMAP syslib functions into common ARM location, so make these functions available to other ARM targets.
arch/arm/include/asm/syslib.h new file +11
-0+/** +* @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)arch/arm/include/asm/syslib.h line 44
Quoted 10 lines
arch/arm/include/asm/syslib.h new file +10
-0+{ +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.
Quoted 4 lines
Quoted 1 line
+void sdelay(unsigned long loops);
The sdelay change is a good one, though I think this should be a static inline function.
Quoted 8 lines
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
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox