.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /******************************************************************************* |
---|
2 | 3 | This is the driver for the GMAC on-chip Ethernet controller for ST SoCs. |
---|
3 | 4 | DWC Ether MAC 10/100/1000 Universal version 3.41a has been used for |
---|
.. | .. |
---|
7 | 8 | |
---|
8 | 9 | Copyright (C) 2007-2009 STMicroelectronics Ltd |
---|
9 | 10 | |
---|
10 | | - This program is free software; you can redistribute it and/or modify it |
---|
11 | | - under the terms and conditions of the GNU General Public License, |
---|
12 | | - version 2, as published by the Free Software Foundation. |
---|
13 | | - |
---|
14 | | - This program is distributed in the hope it will be useful, but WITHOUT |
---|
15 | | - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
16 | | - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
---|
17 | | - more details. |
---|
18 | | - |
---|
19 | | - The full GNU General Public License is included in this distribution in |
---|
20 | | - the file called "COPYING". |
---|
21 | 11 | |
---|
22 | 12 | Author: Giuseppe Cavallaro <peppe.cavallaro@st.com> |
---|
23 | 13 | *******************************************************************************/ |
---|
.. | .. |
---|
122 | 112 | |
---|
123 | 113 | static void dwmac1000_dma_init_rx(void __iomem *ioaddr, |
---|
124 | 114 | struct stmmac_dma_cfg *dma_cfg, |
---|
125 | | - u32 dma_rx_phy, u32 chan) |
---|
| 115 | + dma_addr_t dma_rx_phy, u32 chan) |
---|
126 | 116 | { |
---|
127 | 117 | /* RX descriptor base address list must be written into DMA CSR3 */ |
---|
128 | | - writel(dma_rx_phy, ioaddr + DMA_RCV_BASE_ADDR); |
---|
| 118 | + writel(lower_32_bits(dma_rx_phy), ioaddr + DMA_RCV_BASE_ADDR); |
---|
129 | 119 | } |
---|
130 | 120 | |
---|
131 | 121 | static void dwmac1000_dma_init_tx(void __iomem *ioaddr, |
---|
132 | 122 | struct stmmac_dma_cfg *dma_cfg, |
---|
133 | | - u32 dma_tx_phy, u32 chan) |
---|
| 123 | + dma_addr_t dma_tx_phy, u32 chan) |
---|
134 | 124 | { |
---|
135 | 125 | /* TX descriptor base address list must be written into DMA CSR4 */ |
---|
136 | | - writel(dma_tx_phy, ioaddr + DMA_TX_BASE_ADDR); |
---|
| 126 | + writel(lower_32_bits(dma_tx_phy), ioaddr + DMA_TX_BASE_ADDR); |
---|
137 | 127 | } |
---|
138 | 128 | |
---|
139 | 129 | static u32 dwmac1000_configure_fc(u32 csr6, int rxfifosz) |
---|
.. | .. |
---|
228 | 218 | readl(ioaddr + DMA_BUS_MODE + i * 4); |
---|
229 | 219 | } |
---|
230 | 220 | |
---|
231 | | -static void dwmac1000_get_hw_feature(void __iomem *ioaddr, |
---|
232 | | - struct dma_features *dma_cap) |
---|
| 221 | +static int dwmac1000_get_hw_feature(void __iomem *ioaddr, |
---|
| 222 | + struct dma_features *dma_cap) |
---|
233 | 223 | { |
---|
234 | 224 | u32 hw_cap = readl(ioaddr + DMA_HW_FEATURE); |
---|
| 225 | + |
---|
| 226 | + if (!hw_cap) { |
---|
| 227 | + /* 0x00000000 is the value read on old hardware that does not |
---|
| 228 | + * implement this register |
---|
| 229 | + */ |
---|
| 230 | + return -EOPNOTSUPP; |
---|
| 231 | + } |
---|
235 | 232 | |
---|
236 | 233 | dma_cap->mbps_10_100 = (hw_cap & DMA_HW_FEAT_MIISEL); |
---|
237 | 234 | dma_cap->mbps_1000 = (hw_cap & DMA_HW_FEAT_GMIISEL) >> 1; |
---|
.. | .. |
---|
262 | 259 | dma_cap->number_tx_channel = (hw_cap & DMA_HW_FEAT_TXCHCNT) >> 22; |
---|
263 | 260 | /* Alternate (enhanced) DESC mode */ |
---|
264 | 261 | dma_cap->enh_desc = (hw_cap & DMA_HW_FEAT_ENHDESSEL) >> 24; |
---|
| 262 | + |
---|
| 263 | + return 0; |
---|
265 | 264 | } |
---|
266 | 265 | |
---|
267 | 266 | static void dwmac1000_rx_watchdog(void __iomem *ioaddr, u32 riwt, |
---|