Skip to content

Commit 477286b

Browse files
atorguedavem330
authored andcommitted
stmmac: add GMAC4 core support
This is the initial support for GMAC4 that includes the main callbacks to setup the core module: including Csum, basic filtering, mac address and interrupt (MMC, MTL, PMT) No LPI added. Signed-off-by: Alexandre TORGUE <[email protected]> Signed-off-by: Giuseppe Cavallaro <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 48863ce commit 477286b

File tree

4 files changed

+447
-3
lines changed

4 files changed

+447
-3
lines changed

drivers/net/ethernet/stmicro/stmmac/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \
33
chain_mode.o dwmac_lib.o dwmac1000_core.o dwmac1000_dma.o \
44
dwmac100_core.o dwmac100_dma.o enh_desc.o norm_desc.o \
55
mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o \
6-
dwmac4_dma.o dwmac4_lib.o $(stmmac-y)
6+
dwmac4_dma.o dwmac4_lib.o dwmac4_core.o $(stmmac-y)
77

88
# Ordering matters. Generic driver must be last.
99
obj-$(CONFIG_STMMAC_PLATFORM) += stmmac-platform.o

drivers/net/ethernet/stmicro/stmmac/common.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,21 @@ struct mac_device_info *dwmac1000_setup(void __iomem *ioaddr, int mcbins,
527527
int perfect_uc_entries,
528528
int *synopsys_id);
529529
struct mac_device_info *dwmac100_setup(void __iomem *ioaddr, int *synopsys_id);
530-
530+
struct mac_device_info *dwmac4_setup(void __iomem *ioaddr, int mcbins,
531+
int perfect_uc_entries, int *synopsys_id);
531532

532533
void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
533534
unsigned int high, unsigned int low);
534535
void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
535536
unsigned int high, unsigned int low);
536-
537537
void stmmac_set_mac(void __iomem *ioaddr, bool enable);
538538

539+
void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
540+
unsigned int high, unsigned int low);
541+
void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
542+
unsigned int high, unsigned int low);
543+
void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable);
544+
539545
void dwmac_dma_flush_tx_fifo(void __iomem *ioaddr);
540546
extern const struct stmmac_mode_ops ring_mode_ops;
541547
extern const struct stmmac_mode_ops chain_mode_ops;

drivers/net/ethernet/stmicro/stmmac/dwmac4.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,4 +221,35 @@ enum power_event {
221221
/* To dump the core regs excluding the Address Registers */
222222
#define GMAC_REG_NUM 132
223223

224+
/* MTL debug */
225+
#define MTL_DEBUG_TXSTSFSTS BIT(5)
226+
#define MTL_DEBUG_TXFSTS BIT(4)
227+
#define MTL_DEBUG_TWCSTS BIT(3)
228+
229+
/* MTL debug: Tx FIFO Read Controller Status */
230+
#define MTL_DEBUG_TRCSTS_MASK GENMASK(2, 1)
231+
#define MTL_DEBUG_TRCSTS_SHIFT 1
232+
#define MTL_DEBUG_TRCSTS_IDLE 0
233+
#define MTL_DEBUG_TRCSTS_READ 1
234+
#define MTL_DEBUG_TRCSTS_TXW 2
235+
#define MTL_DEBUG_TRCSTS_WRITE 3
236+
#define MTL_DEBUG_TXPAUSED BIT(0)
237+
238+
/* MAC debug: GMII or MII Transmit Protocol Engine Status */
239+
#define MTL_DEBUG_RXFSTS_MASK GENMASK(5, 4)
240+
#define MTL_DEBUG_RXFSTS_SHIFT 4
241+
#define MTL_DEBUG_RXFSTS_EMPTY 0
242+
#define MTL_DEBUG_RXFSTS_BT 1
243+
#define MTL_DEBUG_RXFSTS_AT 2
244+
#define MTL_DEBUG_RXFSTS_FULL 3
245+
#define MTL_DEBUG_RRCSTS_MASK GENMASK(2, 1)
246+
#define MTL_DEBUG_RRCSTS_SHIFT 1
247+
#define MTL_DEBUG_RRCSTS_IDLE 0
248+
#define MTL_DEBUG_RRCSTS_RDATA 1
249+
#define MTL_DEBUG_RRCSTS_RSTAT 2
250+
#define MTL_DEBUG_RRCSTS_FLUSH 3
251+
#define MTL_DEBUG_RWCSTS BIT(0)
252+
253+
extern const struct stmmac_dma_ops dwmac4_dma_ops;
254+
extern const struct stmmac_dma_ops dwmac410_dma_ops;
224255
#endif /* __DWMAC4_H__ */

0 commit comments

Comments
 (0)