diff options
author | Olof Johansson <olof@lixom.net> | 2008-03-05 13:11:48 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2008-03-05 13:12:14 -0500 |
commit | afea3278f73c14271ee60ca7593ad74b7a946486 (patch) | |
tree | f2a0964c318125eff3199dc387093819d0084760 /arch/powerpc | |
parent | 6a2d322e4b81edc2ab35573f1c52f93d1d16eebb (diff) |
pasemi_mac: Move RX/TX section enablement to dma_lib
Also stop both rx and tx sections before changing the configuration of
the dma device during init.
Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/pasemi/dma_lib.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c index c529d8dff395..48cb7c99962d 100644 --- a/arch/powerpc/platforms/pasemi/dma_lib.c +++ b/arch/powerpc/platforms/pasemi/dma_lib.c | |||
@@ -17,6 +17,7 @@ | |||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | 21 | #include <linux/init.h> |
21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
22 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
@@ -410,6 +411,7 @@ int pasemi_dma_init(void) | |||
410 | struct resource res; | 411 | struct resource res; |
411 | struct device_node *dn; | 412 | struct device_node *dn; |
412 | int i, intf, err = 0; | 413 | int i, intf, err = 0; |
414 | unsigned long timeout; | ||
413 | u32 tmp; | 415 | u32 tmp; |
414 | 416 | ||
415 | if (!machine_is(pasemi)) | 417 | if (!machine_is(pasemi)) |
@@ -478,6 +480,34 @@ int pasemi_dma_init(void) | |||
478 | for (i = 0; i < MAX_RXCH; i++) | 480 | for (i = 0; i < MAX_RXCH; i++) |
479 | __set_bit(i, rxch_free); | 481 | __set_bit(i, rxch_free); |
480 | 482 | ||
483 | timeout = jiffies + HZ; | ||
484 | pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, 0); | ||
485 | while (pasemi_read_dma_reg(PAS_DMA_COM_RXSTA) & 1) { | ||
486 | if (time_after(jiffies, timeout)) { | ||
487 | pr_warning("Warning: Could not disable RX section\n"); | ||
488 | break; | ||
489 | } | ||
490 | } | ||
491 | |||
492 | timeout = jiffies + HZ; | ||
493 | pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, 0); | ||
494 | while (pasemi_read_dma_reg(PAS_DMA_COM_TXSTA) & 1) { | ||
495 | if (time_after(jiffies, timeout)) { | ||
496 | pr_warning("Warning: Could not disable TX section\n"); | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | |||
501 | /* setup resource allocations for the different DMA sections */ | ||
502 | tmp = pasemi_read_dma_reg(PAS_DMA_COM_CFG); | ||
503 | pasemi_write_dma_reg(PAS_DMA_COM_CFG, tmp | 0x18000000); | ||
504 | |||
505 | /* enable tx section */ | ||
506 | pasemi_write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN); | ||
507 | |||
508 | /* enable rx section */ | ||
509 | pasemi_write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN); | ||
510 | |||
481 | printk(KERN_INFO "PA Semi PWRficient DMA library initialized " | 511 | printk(KERN_INFO "PA Semi PWRficient DMA library initialized " |
482 | "(%d tx, %d rx channels)\n", num_txch, num_rxch); | 512 | "(%d tx, %d rx channels)\n", num_txch, num_rxch); |
483 | 513 | ||