Commit c4c9fbebae6a62d538817d0ccee698adaafc5d66

Authored by Anatolij Gustschin
Committed by Wolfgang Denk
1 parent 712fbcf384

consolidate mdelay by providing a common function for all users

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>

Showing 20 changed files with 7 additions and 43 deletions Side-by-side Diff

arch/arm/cpu/arm920t/s3c24x0/usb_ohci.c
... ... @@ -1540,7 +1540,6 @@
1540 1540 writel(RH_HS_LPSC, &ohci->regs->roothub.status);
1541 1541 #endif /* OHCI_USE_NPS */
1542 1542  
1543   -#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
1544 1543 /* POTPGT delay is bits 24-31, in 2 ms units. */
1545 1544 mdelay((roothub_a(ohci) >> 23) & 0x1fe);
1546 1545  
arch/mips/cpu/mips32/au1x00/au1x00_usb_ohci.c
... ... @@ -1448,7 +1448,6 @@
1448 1448 writel (RH_HS_LPSC, &ohci->regs->roothub.status);
1449 1449 #endif /* OHCI_USE_NPS */
1450 1450  
1451   -#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
1452 1451 /* POTPGT delay is bits 24-31, in 2 ms units. */
1453 1452 mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
1454 1453  
arch/powerpc/cpu/mpc5xxx/usb_ohci.c
... ... @@ -1455,7 +1455,6 @@
1455 1455 writel (RH_HS_LPSC, &ohci->regs->roothub.status);
1456 1456 #endif /* OHCI_USE_NPS */
1457 1457  
1458   -#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
1459 1458 /* POTPGT delay is bits 24-31, in 2 ms units. */
1460 1459 mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
1461 1460  
arch/powerpc/cpu/ppc4xx/usb_ohci.c
... ... @@ -1462,7 +1462,6 @@
1462 1462 writel (RH_HS_LPSC, &ohci->regs->roothub.status);
1463 1463 #endif /* OHCI_USE_NPS */
1464 1464  
1465   -#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
1466 1465 /* POTPGT delay is bits 24-31, in 2 ms units. */
1467 1466 mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
1468 1467  
arch/powerpc/include/asm/4xx_pcie.h
... ... @@ -389,14 +389,6 @@
389 389 return 0;
390 390 }
391 391  
392   -static inline void mdelay(int n)
393   -{
394   - u32 ms = n;
395   -
396   - while (ms--)
397   - udelay(1000);
398   -}
399   -
400 392 #if defined(PCIE0_SDR)
401 393 static inline u32 sdr_base(int port)
402 394 {
board/amcc/taishan/lcd.c
... ... @@ -35,8 +35,6 @@
35 35 #define LCD_DATA_ADDR ((volatile char *)(CONFIG_SYS_EBC2_LCM_BASE+1))
36 36 #define LCD_BLK_CTRL ((volatile char *)(CONFIG_SYS_EBC1_FPGA_BASE+0x2))
37 37  
38   -#define mdelay(t) ({unsigned long msec=(t); while (msec--) { udelay(1000);}})
39   -
40 38 static int g_lcd_init_b = 0;
41 39 static char *amcc_logo = " AMCC TAISHAN 440GX EvalBoard";
42 40 static char addr_flag = 0x80;
board/freescale/mx35pdk/mx35pdk.c
... ... @@ -46,8 +46,6 @@
46 46 #error "CONFIG_BOARD_EARLY_INIT_F must be set for this board"
47 47 #endif
48 48  
49   -#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
50   -
51 49 DECLARE_GLOBAL_DATA_PTR;
52 50  
53 51 int dram_init(void)
board/karo/tx25/tx25.c
... ... @@ -31,12 +31,6 @@
31 31 #include <asm/gpio.h>
32 32 #include <asm/arch/sys_proto.h>
33 33  
34   -static void mdelay(int n)
35   -{
36   - while (n-- > 0)
37   - udelay(1000);
38   -}
39   -
40 34 DECLARE_GLOBAL_DATA_PTR;
41 35  
42 36 #ifdef CONFIG_FEC_MXC
board/linkstation/hwctl.c
... ... @@ -19,8 +19,6 @@
19 19 #include <command.h>
20 20 #include <asm/io.h>
21 21  
22   -#define mdelay(n) udelay((n)*1000)
23   -
24 22 #define AVR_PORT CONFIG_SYS_NS16550_COM2
25 23  
26 24 /* 2005.5.10 BUFFALO add */
drivers/block/fsl_sata.c
... ... @@ -50,13 +50,6 @@
50 50 #endif
51 51 };
52 52  
53   -static inline void mdelay(unsigned long msec)
54   -{
55   - unsigned long i;
56   - for (i = 0; i < msec; i++)
57   - udelay(1000);
58   -}
59   -
60 53 static inline void sdelay(unsigned long sec)
61 54 {
62 55 unsigned long i;
drivers/block/ftide020.c
... ... @@ -54,8 +54,6 @@
54 54 #define WRITE_CMD(x) outl((x), &ftide020->cmd_fifo) /* 0x04 */
55 55 #define READ_STATUS() inl(&ftide020->cmd_fifo) /* 0x04 */
56 56  
57   -#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
58   -
59 57 void ftide_set_device(int cx8, int dev)
60 58 {
61 59 static struct ftide020_s *ftide020 = (struct ftide020_s *) FTIDE_BASE;
... ... @@ -50,7 +50,6 @@
50 50  
51 51 #define virt_to_bus(devno, v) pci_virt_to_mem(devno, (void *) (v))
52 52 #define bus_to_phys(devno, a) pci_mem_to_phys(devno, a)
53   -#define mdelay(n) udelay((n)*1000)
54 53  
55 54 #define E1000_DEFAULT_PCI_PBA 0x00000030
56 55 #define E1000_DEFAULT_PCIE_PBA 0x000a0026
drivers/net/ftgmac100.c
... ... @@ -33,8 +33,6 @@
33 33  
34 34 #define ETH_ZLEN 60
35 35  
36   -#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
37   -
38 36 /* RBSR - hw default init value is also 0x640 */
39 37 #define RBSR_DEFAULT_VALUE 0x640
40 38  
drivers/net/ne2000.c
... ... @@ -78,7 +78,6 @@
78 78 /* NE2000 base header file */
79 79 #include "ne2000_base.h"
80 80  
81   -#define mdelay(n) udelay((n)*1000)
82 81 /* find prom (taken from pc_net_cs.c from Linux) */
83 82  
84 83 #include "8390.h"
drivers/net/ne2000_base.c
... ... @@ -77,7 +77,6 @@
77 77 #include <net.h>
78 78 #include <malloc.h>
79 79  
80   -#define mdelay(n) udelay((n)*1000)
81 80 /* forward definition of function used for the uboot interface */
82 81 void uboot_push_packet_len(int len);
83 82 void uboot_push_tx_done(int key, int val);
drivers/net/smc911x.c
... ... @@ -35,8 +35,6 @@
35 35 void pkt_data_push(struct eth_device *dev, u32 addr, u32 val) \
36 36 __attribute__ ((weak, alias ("smc911x_reg_write")));
37 37  
38   -#define mdelay(n) udelay((n)*1000)
39   -
40 38 static void smc911x_handle_mac_address(struct eth_device *dev)
41 39 {
42 40 unsigned long addrh, addrl;
drivers/usb/host/ohci-hcd.c
... ... @@ -1749,7 +1749,6 @@
1749 1749 ohci_writel(RH_HS_LPSC, &ohci->regs->roothub.status);
1750 1750 #endif /* OHCI_USE_NPS */
1751 1751  
1752   -#define mdelay(n) ({unsigned long msec = (n); while (msec--) udelay(1000); })
1753 1752 /* POTPGT delay is bits 24-31, in 2 ms units. */
1754 1753 mdelay((roothub_a(ohci) >> 23) & 0x1fe);
1755 1754  
drivers/usb/host/sl811-hcd.c
... ... @@ -51,8 +51,6 @@
51 51 #define SL811_ADR (0x50000000)
52 52 #define SL811_DAT (0x50000001)
53 53  
54   -#define mdelay(n) ({unsigned long msec=(n); while (msec--) udelay(1000);})
55   -
56 54 #ifdef SL811_DEBUG
57 55 static int debug = 9;
58 56 #endif
... ... @@ -706,6 +706,7 @@
706 706  
707 707 /* lib/time.c */
708 708 void udelay (unsigned long);
  709 +void mdelay(unsigned long);
709 710  
710 711 /* lib/uuid.c */
711 712 void uuid_str_to_bin(const char *uuid, unsigned char *out);
... ... @@ -41,4 +41,10 @@
41 41 usec -= kv;
42 42 } while(usec);
43 43 }
  44 +
  45 +void mdelay(unsigned long msec)
  46 +{
  47 + while (msec--)
  48 + udelay(1000);
  49 +}