diff options
author | Huang, Xiong <xiong@qca.qualcomm.com> | 2012-04-17 15:32:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-18 15:35:31 -0400 |
commit | 37bfccb595ffc1fe4030aa06659d287c1463076e (patch) | |
tree | 9cf46d83fe13eb2eecd05e563ce5339002e85592 /drivers/net/ethernet/atheros | |
parent | 0cbec61c65dd0d0dd26bf321b584365b6eeae478 (diff) |
atl1c: correct wrong definition of REG_DMA_CTRL
some fields of REG_DMA_CTRL(15C0) are wrong, replace with the newest one.
haredware uses fixed dma-write-block size, remove dmaw_block related code
in function atl1c_configure_dma.
Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/atheros')
-rw-r--r-- | drivers/net/ethernet/atheros/atl1c/atl1c_hw.h | 46 | ||||
-rw-r--r-- | drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 29 |
2 files changed, 32 insertions, 43 deletions
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h index 18c1f189b6b3..f502b4de7992 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h | |||
@@ -25,6 +25,12 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/mii.h> | 26 | #include <linux/mii.h> |
27 | 27 | ||
28 | #define FIELD_GETX(_x, _name) ((_x) >> (_name##_SHIFT) & (_name##_MASK)) | ||
29 | #define FIELD_SETX(_x, _name, _v) \ | ||
30 | (((_x) & ~((_name##_MASK) << (_name##_SHIFT))) |\ | ||
31 | (((_v) & (_name##_MASK)) << (_name##_SHIFT))) | ||
32 | #define FIELDX(_name, _v) (((_v) & (_name##_MASK)) << (_name##_SHIFT)) | ||
33 | |||
28 | struct atl1c_adapter; | 34 | struct atl1c_adapter; |
29 | struct atl1c_hw; | 35 | struct atl1c_hw; |
30 | 36 | ||
@@ -528,25 +534,27 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw); | |||
528 | #define RXD_DMA_DOWN_TIMER_SHIFT 16 | 534 | #define RXD_DMA_DOWN_TIMER_SHIFT 16 |
529 | 535 | ||
530 | /* DMA Engine Control Register */ | 536 | /* DMA Engine Control Register */ |
531 | #define REG_DMA_CTRL 0x15C0 | 537 | #define REG_DMA_CTRL 0x15C0 |
532 | #define DMA_CTRL_DMAR_IN_ORDER 0x1 | 538 | #define DMA_CTRL_SMB_NOW BIT(31) |
533 | #define DMA_CTRL_DMAR_ENH_ORDER 0x2 | 539 | #define DMA_CTRL_WPEND_CLR BIT(30) |
534 | #define DMA_CTRL_DMAR_OUT_ORDER 0x4 | 540 | #define DMA_CTRL_RPEND_CLR BIT(29) |
535 | #define DMA_CTRL_RCB_VALUE 0x8 | 541 | #define DMA_CTRL_WDLY_CNT_MASK 0xFUL |
536 | #define DMA_CTRL_DMAR_BURST_LEN_MASK 0x0007 | 542 | #define DMA_CTRL_WDLY_CNT_SHIFT 16 |
537 | #define DMA_CTRL_DMAR_BURST_LEN_SHIFT 4 | 543 | #define DMA_CTRL_WDLY_CNT_DEF 4 |
538 | #define DMA_CTRL_DMAW_BURST_LEN_MASK 0x0007 | 544 | #define DMA_CTRL_RDLY_CNT_MASK 0x1FUL |
539 | #define DMA_CTRL_DMAW_BURST_LEN_SHIFT 7 | 545 | #define DMA_CTRL_RDLY_CNT_SHIFT 11 |
540 | #define DMA_CTRL_DMAR_REQ_PRI 0x400 | 546 | #define DMA_CTRL_RDLY_CNT_DEF 15 |
541 | #define DMA_CTRL_DMAR_DLY_CNT_MASK 0x001F | 547 | #define DMA_CTRL_RREQ_PRI_DATA BIT(10) /* 0:tpd, 1:data */ |
542 | #define DMA_CTRL_DMAR_DLY_CNT_SHIFT 11 | 548 | #define DMA_CTRL_WREQ_BLEN_MASK 7UL |
543 | #define DMA_CTRL_DMAW_DLY_CNT_MASK 0x000F | 549 | #define DMA_CTRL_WREQ_BLEN_SHIFT 7 |
544 | #define DMA_CTRL_DMAW_DLY_CNT_SHIFT 16 | 550 | #define DMA_CTRL_RREQ_BLEN_MASK 7UL |
545 | #define DMA_CTRL_CMB_EN 0x100000 | 551 | #define DMA_CTRL_RREQ_BLEN_SHIFT 4 |
546 | #define DMA_CTRL_SMB_EN 0x200000 | 552 | #define L1C_CTRL_DMA_RCB_LEN128 BIT(3) /* 0:64bytes,1:128bytes */ |
547 | #define DMA_CTRL_CMB_NOW 0x400000 | 553 | #define DMA_CTRL_RORDER_MODE_MASK 7UL |
548 | #define MAC_CTRL_SMB_DIS 0x1000000 | 554 | #define DMA_CTRL_RORDER_MODE_SHIFT 0 |
549 | #define DMA_CTRL_SMB_NOW 0x80000000 | 555 | #define DMA_CTRL_RORDER_MODE_OUT 4 |
556 | #define DMA_CTRL_RORDER_MODE_ENHANCE 2 | ||
557 | #define DMA_CTRL_RORDER_MODE_IN 1 | ||
550 | 558 | ||
551 | /* INT-triggle/SMB Control Register */ | 559 | /* INT-triggle/SMB Control Register */ |
552 | #define REG_SMB_STAT_TIMER 0x15C4 /* 2us resolution */ | 560 | #define REG_SMB_STAT_TIMER 0x15C4 /* 2us resolution */ |
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c index 7688915172a5..461305e1f763 100644 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c | |||
@@ -1099,30 +1099,11 @@ static void atl1c_configure_dma(struct atl1c_adapter *adapter) | |||
1099 | struct atl1c_hw *hw = &adapter->hw; | 1099 | struct atl1c_hw *hw = &adapter->hw; |
1100 | u32 dma_ctrl_data; | 1100 | u32 dma_ctrl_data; |
1101 | 1101 | ||
1102 | dma_ctrl_data = DMA_CTRL_DMAR_REQ_PRI; | 1102 | dma_ctrl_data = FIELDX(DMA_CTRL_RORDER_MODE, DMA_CTRL_RORDER_MODE_OUT) | |
1103 | 1103 | DMA_CTRL_RREQ_PRI_DATA | | |
1104 | switch (hw->dma_order) { | 1104 | FIELDX(DMA_CTRL_RREQ_BLEN, hw->dmar_block) | |
1105 | case atl1c_dma_ord_in: | 1105 | FIELDX(DMA_CTRL_WDLY_CNT, DMA_CTRL_WDLY_CNT_DEF) | |
1106 | dma_ctrl_data |= DMA_CTRL_DMAR_IN_ORDER; | 1106 | FIELDX(DMA_CTRL_RDLY_CNT, DMA_CTRL_RDLY_CNT_DEF); |
1107 | break; | ||
1108 | case atl1c_dma_ord_enh: | ||
1109 | dma_ctrl_data |= DMA_CTRL_DMAR_ENH_ORDER; | ||
1110 | break; | ||
1111 | case atl1c_dma_ord_out: | ||
1112 | dma_ctrl_data |= DMA_CTRL_DMAR_OUT_ORDER; | ||
1113 | break; | ||
1114 | default: | ||
1115 | break; | ||
1116 | } | ||
1117 | |||
1118 | dma_ctrl_data |= (((u32)hw->dmar_block) & DMA_CTRL_DMAR_BURST_LEN_MASK) | ||
1119 | << DMA_CTRL_DMAR_BURST_LEN_SHIFT; | ||
1120 | dma_ctrl_data |= (((u32)hw->dmaw_block) & DMA_CTRL_DMAW_BURST_LEN_MASK) | ||
1121 | << DMA_CTRL_DMAW_BURST_LEN_SHIFT; | ||
1122 | dma_ctrl_data |= (((u32)hw->dmar_dly_cnt) & DMA_CTRL_DMAR_DLY_CNT_MASK) | ||
1123 | << DMA_CTRL_DMAR_DLY_CNT_SHIFT; | ||
1124 | dma_ctrl_data |= (((u32)hw->dmaw_dly_cnt) & DMA_CTRL_DMAW_DLY_CNT_MASK) | ||
1125 | << DMA_CTRL_DMAW_DLY_CNT_SHIFT; | ||
1126 | 1107 | ||
1127 | AT_WRITE_REG(hw, REG_DMA_CTRL, dma_ctrl_data); | 1108 | AT_WRITE_REG(hw, REG_DMA_CTRL, dma_ctrl_data); |
1128 | } | 1109 | } |