diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 19:01:43 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 19:01:43 -0400 |
| commit | da61396d24e37258817e42537c482e962b4742f7 (patch) | |
| tree | 4293a5d557b8f9fed8a2bac93f1e5c939c7b65c3 /drivers/net/wan | |
| parent | 2f058256cb64e346f4fb4499ff4e0f1c2791a4b4 (diff) | |
| parent | 8f3d17fb7bcb7c255197d11469fb5e9695c9d2f4 (diff) | |
Merge upstream kernel into libata 'passthru' branch
Diffstat (limited to 'drivers/net/wan')
| -rw-r--r-- | drivers/net/wan/cycx_drv.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c index 6e74af62ca08..9e56fc346ba4 100644 --- a/drivers/net/wan/cycx_drv.c +++ b/drivers/net/wan/cycx_drv.c | |||
| @@ -56,7 +56,7 @@ | |||
| 56 | #include <linux/sched.h> /* for jiffies, HZ, etc. */ | 56 | #include <linux/sched.h> /* for jiffies, HZ, etc. */ |
| 57 | #include <linux/cycx_drv.h> /* API definitions */ | 57 | #include <linux/cycx_drv.h> /* API definitions */ |
| 58 | #include <linux/cycx_cfm.h> /* CYCX firmware module definitions */ | 58 | #include <linux/cycx_cfm.h> /* CYCX firmware module definitions */ |
| 59 | #include <linux/delay.h> /* udelay */ | 59 | #include <linux/delay.h> /* udelay, msleep_interruptible */ |
| 60 | #include <asm/io.h> /* read[wl], write[wl], ioremap, iounmap */ | 60 | #include <asm/io.h> /* read[wl], write[wl], ioremap, iounmap */ |
| 61 | 61 | ||
| 62 | #define MOD_VERSION 0 | 62 | #define MOD_VERSION 0 |
| @@ -74,7 +74,6 @@ static int reset_cyc2x(void __iomem *addr); | |||
| 74 | static int detect_cyc2x(void __iomem *addr); | 74 | static int detect_cyc2x(void __iomem *addr); |
| 75 | 75 | ||
| 76 | /* Miscellaneous functions */ | 76 | /* Miscellaneous functions */ |
| 77 | static void delay_cycx(int sec); | ||
| 78 | static int get_option_index(long *optlist, long optval); | 77 | static int get_option_index(long *optlist, long optval); |
| 79 | static u16 checksum(u8 *buf, u32 len); | 78 | static u16 checksum(u8 *buf, u32 len); |
| 80 | 79 | ||
| @@ -259,7 +258,7 @@ static int memory_exists(void __iomem *addr) | |||
| 259 | if (readw(addr + 0x10) == TEST_PATTERN) | 258 | if (readw(addr + 0x10) == TEST_PATTERN) |
| 260 | return 1; | 259 | return 1; |
| 261 | 260 | ||
| 262 | delay_cycx(1); | 261 | msleep_interruptible(1 * 1000); |
| 263 | } | 262 | } |
| 264 | 263 | ||
| 265 | return 0; | 264 | return 0; |
| @@ -316,7 +315,7 @@ static void cycx_reset_boot(void __iomem *addr, u8 *code, u32 len) | |||
| 316 | 315 | ||
| 317 | /* 80186 was in hold, go */ | 316 | /* 80186 was in hold, go */ |
| 318 | writeb(0, addr + START_CPU); | 317 | writeb(0, addr + START_CPU); |
| 319 | delay_cycx(1); | 318 | msleep_interruptible(1 * 1000); |
| 320 | } | 319 | } |
| 321 | 320 | ||
| 322 | /* Load data.bin file through boot (reset) interface. */ | 321 | /* Load data.bin file through boot (reset) interface. */ |
| @@ -462,13 +461,13 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) | |||
| 462 | cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size); | 461 | cycx_reset_boot(hw->dpmbase, reset_image, img_hdr->reset_size); |
| 463 | /* reset is waiting for boot */ | 462 | /* reset is waiting for boot */ |
| 464 | writew(GEN_POWER_ON, pt_cycld); | 463 | writew(GEN_POWER_ON, pt_cycld); |
| 465 | delay_cycx(1); | 464 | msleep_interruptible(1 * 1000); |
| 466 | 465 | ||
| 467 | for (j = 0 ; j < 3 ; j++) | 466 | for (j = 0 ; j < 3 ; j++) |
| 468 | if (!readw(pt_cycld)) | 467 | if (!readw(pt_cycld)) |
| 469 | goto reset_loaded; | 468 | goto reset_loaded; |
| 470 | else | 469 | else |
| 471 | delay_cycx(1); | 470 | msleep_interruptible(1 * 1000); |
| 472 | } | 471 | } |
| 473 | 472 | ||
| 474 | printk(KERN_ERR "%s: reset not started.\n", modname); | 473 | printk(KERN_ERR "%s: reset not started.\n", modname); |
| @@ -495,7 +494,7 @@ reset_loaded: | |||
| 495 | 494 | ||
| 496 | /* Arthur Ganzert's tip: wait a while after the firmware loading... | 495 | /* Arthur Ganzert's tip: wait a while after the firmware loading... |
| 497 | seg abr 26 17:17:12 EST 1999 - acme */ | 496 | seg abr 26 17:17:12 EST 1999 - acme */ |
| 498 | delay_cycx(7); | 497 | msleep_interruptible(7 * 1000); |
| 499 | printk(KERN_INFO "%s: firmware loaded!\n", modname); | 498 | printk(KERN_INFO "%s: firmware loaded!\n", modname); |
| 500 | 499 | ||
| 501 | /* enable interrupts */ | 500 | /* enable interrupts */ |
| @@ -547,20 +546,13 @@ static int get_option_index(long *optlist, long optval) | |||
| 547 | static int reset_cyc2x(void __iomem *addr) | 546 | static int reset_cyc2x(void __iomem *addr) |
| 548 | { | 547 | { |
| 549 | writeb(0, addr + RST_ENABLE); | 548 | writeb(0, addr + RST_ENABLE); |
| 550 | delay_cycx(2); | 549 | msleep_interruptible(2 * 1000); |
| 551 | writeb(0, addr + RST_DISABLE); | 550 | writeb(0, addr + RST_DISABLE); |
| 552 | delay_cycx(2); | 551 | msleep_interruptible(2 * 1000); |
| 553 | 552 | ||
| 554 | return memory_exists(addr); | 553 | return memory_exists(addr); |
| 555 | } | 554 | } |
| 556 | 555 | ||
| 557 | /* Delay */ | ||
| 558 | static void delay_cycx(int sec) | ||
| 559 | { | ||
| 560 | set_current_state(TASK_INTERRUPTIBLE); | ||
| 561 | schedule_timeout(sec * HZ); | ||
| 562 | } | ||
| 563 | |||
| 564 | /* Calculate 16-bit CRC using CCITT polynomial. */ | 556 | /* Calculate 16-bit CRC using CCITT polynomial. */ |
| 565 | static u16 checksum(u8 *buf, u32 len) | 557 | static u16 checksum(u8 *buf, u32 len) |
| 566 | { | 558 | { |
