.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /******************************************************************************* |
---|
2 | 3 | Copyright (C) 2007-2009 STMicroelectronics Ltd |
---|
3 | 4 | |
---|
4 | | - This program is free software; you can redistribute it and/or modify it |
---|
5 | | - under the terms and conditions of the GNU General Public License, |
---|
6 | | - version 2, as published by the Free Software Foundation. |
---|
7 | | - |
---|
8 | | - This program is distributed in the hope it will be useful, but WITHOUT |
---|
9 | | - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
10 | | - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
11 | | - more details. |
---|
12 | | - |
---|
13 | | - The full GNU General Public License is included in this distribution in |
---|
14 | | - the file called "COPYING". |
---|
15 | 5 | |
---|
16 | 6 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> |
---|
17 | 7 | *******************************************************************************/ |
---|
.. | .. |
---|
26 | 16 | int dwmac_dma_reset(void __iomem *ioaddr) |
---|
27 | 17 | { |
---|
28 | 18 | u32 value = readl(ioaddr + DMA_BUS_MODE); |
---|
29 | | - int err; |
---|
30 | 19 | |
---|
31 | 20 | /* DMA SW reset */ |
---|
32 | 21 | value |= DMA_BUS_MODE_SFT_RESET; |
---|
33 | 22 | writel(value, ioaddr + DMA_BUS_MODE); |
---|
34 | 23 | |
---|
35 | | - err = readl_poll_timeout(ioaddr + DMA_BUS_MODE, value, |
---|
| 24 | + return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value, |
---|
36 | 25 | !(value & DMA_BUS_MODE_SFT_RESET), |
---|
37 | | - 10000, 100000); |
---|
38 | | - if (err) |
---|
39 | | - return -EBUSY; |
---|
40 | | - |
---|
41 | | - return 0; |
---|
| 26 | + 10000, 200000); |
---|
42 | 27 | } |
---|
43 | 28 | |
---|
44 | 29 | /* CSR1 enables the transmit DMA to check for new descriptor */ |
---|
.. | .. |
---|
47 | 32 | writel(1, ioaddr + DMA_XMT_POLL_DEMAND); |
---|
48 | 33 | } |
---|
49 | 34 | |
---|
50 | | -void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan) |
---|
| 35 | +void dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx) |
---|
51 | 36 | { |
---|
52 | | - writel(DMA_INTR_DEFAULT_MASK, ioaddr + DMA_INTR_ENA); |
---|
| 37 | + u32 value = readl(ioaddr + DMA_INTR_ENA); |
---|
| 38 | + |
---|
| 39 | + if (rx) |
---|
| 40 | + value |= DMA_INTR_DEFAULT_RX; |
---|
| 41 | + if (tx) |
---|
| 42 | + value |= DMA_INTR_DEFAULT_TX; |
---|
| 43 | + |
---|
| 44 | + writel(value, ioaddr + DMA_INTR_ENA); |
---|
53 | 45 | } |
---|
54 | 46 | |
---|
55 | | -void dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan) |
---|
| 47 | +void dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx) |
---|
56 | 48 | { |
---|
57 | | - writel(0, ioaddr + DMA_INTR_ENA); |
---|
| 49 | + u32 value = readl(ioaddr + DMA_INTR_ENA); |
---|
| 50 | + |
---|
| 51 | + if (rx) |
---|
| 52 | + value &= ~DMA_INTR_DEFAULT_RX; |
---|
| 53 | + if (tx) |
---|
| 54 | + value &= ~DMA_INTR_DEFAULT_TX; |
---|
| 55 | + |
---|
| 56 | + writel(value, ioaddr + DMA_INTR_ENA); |
---|
58 | 57 | } |
---|
59 | 58 | |
---|
60 | 59 | void dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan) |
---|