1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef BCM63XX_DEV_ENET_H_
3 #define BCM63XX_DEV_ENET_H_
5 #include <linux/if_ether.h>
6 #include <linux/init.h>
8 #include <bcm63xx_regs.h>
11 * on board ethernet platform data
13 struct bcm63xx_enet_platform_data {
14 char mac_addr[ETH_ALEN];
18 /* if has_phy, then set use_internal_phy */
21 /* or fill phy info to use an external one */
23 int has_phy_interrupt;
26 /* if has_phy, use autonegotiated pause parameters or force
32 /* if !has_phy, set desired forced speed/duplex */
34 int force_duplex_full;
36 /* if !has_phy, set callback to perform mii device
38 int (*mii_config)(struct net_device *dev, int probe,
39 int (*mii_read)(struct net_device *dev,
41 void (*mii_write)(struct net_device *dev,
42 int phy_id, int reg, int val));
44 /* DMA channel enable mask */
47 /* DMA channel interrupt mask */
48 u32 dma_chan_int_mask;
50 /* DMA engine has internal SRAM */
53 /* DMA channel register width */
54 unsigned int dma_chan_width;
56 /* DMA descriptor shift */
57 unsigned int dma_desc_shift;
65 * on board ethernet switch platform data
67 #define ENETSW_MAX_PORT 8
68 #define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
69 #define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
71 #define ENETSW_RGMII_PORT0 4
73 struct bcm63xx_enetsw_port {
79 int force_duplex_full;
84 struct bcm63xx_enetsw_platform_data {
85 char mac_addr[ETH_ALEN];
87 struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
89 /* DMA channel enable mask */
92 /* DMA channel interrupt mask */
93 u32 dma_chan_int_mask;
95 /* DMA channel register width */
96 unsigned int dma_chan_width;
98 /* DMA engine has internal SRAM */
102 int __init bcm63xx_enet_register(int unit,
103 const struct bcm63xx_enet_platform_data *pd);
105 int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
107 enum bcm63xx_regs_enetdmac {
118 static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg)
120 extern const unsigned long *bcm63xx_regs_enetdmac;
122 return bcm63xx_regs_enetdmac[reg];
126 #endif /* ! BCM63XX_DEV_ENET_H_ */