]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
consolidate mdelay by providing a common function for all users
authorAnatolij Gustschin <agust@denx.de>
Wed, 12 Oct 2011 02:31:39 +0000 (02:31 +0000)
committerWolfgang Denk <wd@denx.de>
Fri, 21 Oct 2011 23:16:08 +0000 (01:16 +0200)
There are several mdelay() definitions in the driver and
board code. Remove them all and provide a common mdelay()
in lib/time.c.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Mike Frysinger <vapier@gentoo.org>
20 files changed:
arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
arch/powerpc/cpu/mpc5xxx/usb_ohci.c
arch/powerpc/cpu/ppc4xx/usb_ohci.c
arch/powerpc/include/asm/4xx_pcie.h
board/amcc/taishan/lcd.c
board/freescale/mx35pdk/mx35pdk.c
board/karo/tx25/tx25.c
board/linkstation/hwctl.c
drivers/block/fsl_sata.c
drivers/block/ftide020.c
drivers/net/e1000.c
drivers/net/ftgmac100.c
drivers/net/ne2000.c
drivers/net/ne2000_base.c
drivers/net/smc911x.c
drivers/usb/host/ohci-hcd.c
drivers/usb/host/sl811-hcd.c
include/common.h
lib/time.c

index 9a0bbaeb4c9c2334c0970add0236855464bea01c..263d2ce65d9cd90eef8bdc274c3f7c971c4a9f68 100644 (file)
@@ -1540,7 +1540,6 @@ static int hc_start(struct ohci *ohci)
        writel(RH_HS_LPSC, &ohci->regs->roothub.status);
 #endif /* OHCI_USE_NPS */
 
-#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
        /* POTPGT delay is bits 24-31, in 2 ms units. */
        mdelay((roothub_a(ohci) >> 23) & 0x1fe);
 
index 0bc2305d8786cfc4c87876bfba785f362aa0b9aa..866dd6cfe4af6ab6838c1093b28af8545b27a5a4 100644 (file)
@@ -1448,7 +1448,6 @@ static int hc_start (ohci_t * ohci)
        writel (RH_HS_LPSC, &ohci->regs->roothub.status);
 #endif /* OHCI_USE_NPS */
 
-#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
        /* POTPGT delay is bits 24-31, in 2 ms units. */
        mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
 
index 7976e4df7d825490c0c1ca839b052722bd888b79..2fc1180b78285a46c9c55c0dd37f709333af2eec 100644 (file)
@@ -1455,7 +1455,6 @@ static int hc_start (ohci_t * ohci)
        writel (RH_HS_LPSC, &ohci->regs->roothub.status);
 #endif /* OHCI_USE_NPS */
 
-#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
        /* POTPGT delay is bits 24-31, in 2 ms units. */
        mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
 
index a9edacd330f3cc12340de1d47a072715d3e2c08d..fe091e3fa083c6e5e1efa2c4c2020aaa4338910a 100644 (file)
@@ -1462,7 +1462,6 @@ static int hc_start (ohci_t * ohci)
        writel (RH_HS_LPSC, &ohci->regs->roothub.status);
 #endif /* OHCI_USE_NPS */
 
-#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
        /* POTPGT delay is bits 24-31, in 2 ms units. */
        mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
 
index 90e0bd98fa8b3d50be4fde27be52022c7a3972bc..fbdc28e0a5e1ba4df75e83cc4462ba56e8e2ea4b 100644 (file)
@@ -389,14 +389,6 @@ static inline int is_end_point(int port)
        return 0;
 }
 
-static inline void mdelay(int n)
-{
-       u32 ms = n;
-
-       while (ms--)
-               udelay(1000);
-}
-
 #if defined(PCIE0_SDR)
 static inline u32 sdr_base(int port)
 {
index 7f7730a81d1b23af207d8346d98e26d9dd31fb4d..8208ef3955789f06b5e8e64199c8786ec1fb6ee7 100644 (file)
@@ -35,8 +35,6 @@
 #define LCD_DATA_ADDR          ((volatile char *)(CONFIG_SYS_EBC2_LCM_BASE+1))
 #define LCD_BLK_CTRL           ((volatile char *)(CONFIG_SYS_EBC1_FPGA_BASE+0x2))
 
-#define mdelay(t)      ({unsigned long msec=(t); while (msec--) { udelay(1000);}})
-
 static int g_lcd_init_b = 0;
 static char *amcc_logo = "  AMCC TAISHAN  440GX EvalBoard";
 static char addr_flag = 0x80;
index 9eefe5ee16882749e5308b38203cf126932c4902..8f9b85733417637aedc935bf5fa1be030ee014f9 100644 (file)
@@ -46,8 +46,6 @@
 #error "CONFIG_BOARD_EARLY_INIT_F must be set for this board"
 #endif
 
-#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
-
 DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
index 307ffd0cbe5fbb34b088d3f0521aeff29ea4c7ac..ec83f997cc62ee3ca84c2e399c2d6780025a8bb2 100644 (file)
 #include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>
 
-static void mdelay(int n)
-{
-       while (n-- > 0)
-               udelay(1000);
-}
-
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FEC_MXC
index 9fd56ae23459aa70a1cf3a6e48395b1ef1a45bfb..d2090be1ad5a53f74233bca5af7c623f67cfc515 100644 (file)
@@ -19,8 +19,6 @@
 #include <command.h>
 #include <asm/io.h>
 
-#define mdelay(n)      udelay((n)*1000)
-
 #define AVR_PORT CONFIG_SYS_NS16550_COM2
 
 /* 2005.5.10 BUFFALO add */
index b101bd76403176f30c3c562563aa7b9e7bb01b4d..6b3517369ddd4c13941207f280e5e494797167f4 100644 (file)
@@ -50,13 +50,6 @@ static struct fsl_sata_info fsl_sata_info[] = {
 #endif
 };
 
-static inline void mdelay(unsigned long msec)
-{
-       unsigned long i;
-       for (i = 0; i < msec; i++)
-               udelay(1000);
-}
-
 static inline void sdelay(unsigned long sec)
 {
        unsigned long i;
index 2eef3e939aaf44408f512f82d68ecc26a5de1753..4a7a07f60b21514330eacf9ffb46c4501cca19e5 100644 (file)
@@ -54,8 +54,6 @@
 #define WRITE_CMD(x)   outl((x), &ftide020->cmd_fifo)  /* 0x04 */
 #define READ_STATUS()  inl(&ftide020->cmd_fifo)        /* 0x04 */
 
-#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
-
 void ftide_set_device(int cx8, int dev)
 {
        static struct ftide020_s *ftide020 = (struct ftide020_s *) FTIDE_BASE;
index 98145bc6edd3ff932147e8d56afacccbb7f3dd41..01bdf814fd8605d8fbcdf27fa6c8a2a453eb82de 100644 (file)
@@ -50,7 +50,6 @@ tested on both gig copper and gig fiber boards
 
 #define virt_to_bus(devno, v)  pci_virt_to_mem(devno, (void *) (v))
 #define bus_to_phys(devno, a)  pci_mem_to_phys(devno, a)
-#define mdelay(n)      udelay((n)*1000)
 
 #define E1000_DEFAULT_PCI_PBA  0x00000030
 #define E1000_DEFAULT_PCIE_PBA 0x000a0026
index 821840f8e982ab9476f5026420876f74f67a2401..0af0c3450f05a2c51648ba3dfe71cee1a4dc8cc2 100644 (file)
@@ -33,8 +33,6 @@
 
 #define ETH_ZLEN       60
 
-#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
-
 /* RBSR - hw default init value is also 0x640 */
 #define RBSR_DEFAULT_VALUE     0x640
 
index 7a85314eb9bc93b9124d04959255a521a0f46b4a..39391580feda2e7c86b504f62787d28c8fa2a9cd 100644 (file)
@@ -78,7 +78,6 @@ Add SNMP
 /* NE2000 base header file */
 #include "ne2000_base.h"
 
-#define mdelay(n) udelay((n)*1000)
 /* find prom (taken from pc_net_cs.c from Linux) */
 
 #include "8390.h"
index f93f93227786c8d520543035ff6692ad067431b0..f0cd2b62eb3e8132910dbf8533846543c80756b5 100644 (file)
@@ -77,7 +77,6 @@ Add SNMP
 #include <net.h>
 #include <malloc.h>
 
-#define mdelay(n)      udelay((n)*1000)
 /* forward definition of function used for the uboot interface */
 void uboot_push_packet_len(int len);
 void uboot_push_tx_done(int key, int val);
index a677fd487adde9e2165b145ae2477247506ea353..e34b4879d0df0c9fa814d30dd19c7df2e825f2bf 100644 (file)
@@ -35,8 +35,6 @@ u32 pkt_data_pull(struct eth_device *dev, u32 addr) \
 void pkt_data_push(struct eth_device *dev, u32 addr, u32 val) \
        __attribute__ ((weak, alias ("smc911x_reg_write")));
 
-#define mdelay(n)       udelay((n)*1000)
-
 static void smc911x_handle_mac_address(struct eth_device *dev)
 {
        unsigned long addrh, addrl;
index c20d7064277bb82f60a649be5f2caee6cbe09eb6..60c9595268744102e2e8a68e460986dc18d8f55a 100644 (file)
@@ -1749,7 +1749,6 @@ static int hc_start(ohci_t *ohci)
        ohci_writel(RH_HS_LPSC, &ohci->regs->roothub.status);
 #endif /* OHCI_USE_NPS */
 
-#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
        /* POTPGT delay is bits 24-31, in 2 ms units. */
        mdelay((roothub_a(ohci) >> 23) & 0x1fe);
 
index 82a8b365f4e67343e07fb604cf63482b024e5497..c713d421c6f616b5c364c98292613f172e7d6080 100644 (file)
@@ -51,8 +51,6 @@
 #define         SL811_ADR (0x50000000)
 #define         SL811_DAT (0x50000001)
 
-#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
-
 #ifdef SL811_DEBUG
 static int debug = 9;
 #endif
index e3ef66d8939bf9f2539d59bc5c9798b00ec08fa8..ccd3dd785af7bba27808838424f61e7c5c56f132 100644 (file)
@@ -706,6 +706,7 @@ int strcmp_compar(const void *, const void *);
 
 /* lib/time.c */
 void   udelay        (unsigned long);
+void mdelay(unsigned long);
 
 /* lib/uuid.c */
 void uuid_str_to_bin(const char *uuid, unsigned char *out);
index a309c2613ab06900aae06aae9ceb7b44bd224346..6e2937b8e726d4f2ffc009d91f6f4ff53a432c6f 100644 (file)
@@ -41,3 +41,9 @@ void udelay(unsigned long usec)
                usec -= kv;
        } while(usec);
 }
+
+void mdelay(unsigned long msec)
+{
+       while (msec--)
+               udelay(1000);
+}