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 | |
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>
-rw-r--r-- | arch/powerpc/platforms/pasemi/dma_lib.c | 30 | ||||
-rw-r--r-- | drivers/net/pasemi_mac.c | 6 | ||||
-rw-r--r-- | include/asm-powerpc/pasemi_dma.h | 7 |
3 files changed, 36 insertions, 7 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 | ||
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 2e39e0285d8f..6ea822addde5 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -1043,12 +1043,6 @@ static int pasemi_mac_open(struct net_device *dev) | |||
1043 | unsigned int flags; | 1043 | unsigned int flags; |
1044 | int ret; | 1044 | int ret; |
1045 | 1045 | ||
1046 | /* enable rx section */ | ||
1047 | write_dma_reg(PAS_DMA_COM_RXCMD, PAS_DMA_COM_RXCMD_EN); | ||
1048 | |||
1049 | /* enable tx section */ | ||
1050 | write_dma_reg(PAS_DMA_COM_TXCMD, PAS_DMA_COM_TXCMD_EN); | ||
1051 | |||
1052 | flags = PAS_MAC_CFG_TXP_FCE | PAS_MAC_CFG_TXP_FPC(3) | | 1046 | flags = PAS_MAC_CFG_TXP_FCE | PAS_MAC_CFG_TXP_FPC(3) | |
1053 | PAS_MAC_CFG_TXP_SL(3) | PAS_MAC_CFG_TXP_COB(0xf) | | 1047 | PAS_MAC_CFG_TXP_SL(3) | PAS_MAC_CFG_TXP_COB(0xf) | |
1054 | PAS_MAC_CFG_TXP_TIFT(8) | PAS_MAC_CFG_TXP_TIFG(12); | 1048 | PAS_MAC_CFG_TXP_TIFT(8) | PAS_MAC_CFG_TXP_TIFG(12); |
diff --git a/include/asm-powerpc/pasemi_dma.h b/include/asm-powerpc/pasemi_dma.h index b4526ff3a50d..35577b6dec41 100644 --- a/include/asm-powerpc/pasemi_dma.h +++ b/include/asm-powerpc/pasemi_dma.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2006 PA Semi, Inc | 2 | * Copyright (C) 2006-2008 PA Semi, Inc |
3 | * | 3 | * |
4 | * Hardware register layout and descriptor formats for the on-board | 4 | * Hardware register layout and descriptor formats for the on-board |
5 | * DMA engine on PA Semi PWRficient. Used by ethernet, function and security | 5 | * DMA engine on PA Semi PWRficient. Used by ethernet, function and security |
@@ -40,6 +40,11 @@ enum { | |||
40 | PAS_DMA_COM_TXSTA = 0x104, /* Transmit Status Register */ | 40 | PAS_DMA_COM_TXSTA = 0x104, /* Transmit Status Register */ |
41 | PAS_DMA_COM_RXCMD = 0x108, /* Receive Command Register */ | 41 | PAS_DMA_COM_RXCMD = 0x108, /* Receive Command Register */ |
42 | PAS_DMA_COM_RXSTA = 0x10c, /* Receive Status Register */ | 42 | PAS_DMA_COM_RXSTA = 0x10c, /* Receive Status Register */ |
43 | PAS_DMA_COM_CFG = 0x114, /* Common config reg */ | ||
44 | PAS_DMA_TXF_SFLG0 = 0x140, /* Set flags */ | ||
45 | PAS_DMA_TXF_SFLG1 = 0x144, /* Set flags */ | ||
46 | PAS_DMA_TXF_CFLG0 = 0x148, /* Set flags */ | ||
47 | PAS_DMA_TXF_CFLG1 = 0x14c, /* Set flags */ | ||
43 | }; | 48 | }; |
44 | 49 | ||
45 | 50 | ||