bcm63xx_dev_enet.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef BCM63XX_DEV_ENET_H_
  3. #define BCM63XX_DEV_ENET_H_
  4. #include <linux/if_ether.h>
  5. #include <linux/init.h>
  6. #include <bcm63xx_regs.h>
  7. /*
  8. * on board ethernet platform data
  9. */
  10. struct bcm63xx_enet_platform_data {
  11. char mac_addr[ETH_ALEN];
  12. int has_phy;
  13. /* if has_phy, then set use_internal_phy */
  14. int use_internal_phy;
  15. /* or fill phy info to use an external one */
  16. int phy_id;
  17. int has_phy_interrupt;
  18. int phy_interrupt;
  19. /* if has_phy, use autonegotiated pause parameters or force
  20. * them */
  21. int pause_auto;
  22. int pause_rx;
  23. int pause_tx;
  24. /* if !has_phy, set desired forced speed/duplex */
  25. int force_speed_100;
  26. int force_duplex_full;
  27. /* if !has_phy, set callback to perform mii device
  28. * init/remove */
  29. int (*mii_config)(struct net_device *dev, int probe,
  30. int (*mii_read)(struct net_device *dev,
  31. int phy_id, int reg),
  32. void (*mii_write)(struct net_device *dev,
  33. int phy_id, int reg, int val));
  34. /* DMA channel enable mask */
  35. u32 dma_chan_en_mask;
  36. /* DMA channel interrupt mask */
  37. u32 dma_chan_int_mask;
  38. /* DMA engine has internal SRAM */
  39. bool dma_has_sram;
  40. /* DMA channel register width */
  41. unsigned int dma_chan_width;
  42. /* DMA descriptor shift */
  43. unsigned int dma_desc_shift;
  44. /* dma channel ids */
  45. int rx_chan;
  46. int tx_chan;
  47. };
  48. /*
  49. * on board ethernet switch platform data
  50. */
  51. #define ENETSW_MAX_PORT 8
  52. #define ENETSW_PORTS_6328 5 /* 4 FE PHY + 1 RGMII */
  53. #define ENETSW_PORTS_6368 6 /* 4 FE PHY + 2 RGMII */
  54. #define ENETSW_RGMII_PORT0 4
  55. struct bcm63xx_enetsw_port {
  56. int used;
  57. int phy_id;
  58. int bypass_link;
  59. int force_speed;
  60. int force_duplex_full;
  61. const char *name;
  62. };
  63. struct bcm63xx_enetsw_platform_data {
  64. char mac_addr[ETH_ALEN];
  65. int num_ports;
  66. struct bcm63xx_enetsw_port used_ports[ENETSW_MAX_PORT];
  67. /* DMA channel enable mask */
  68. u32 dma_chan_en_mask;
  69. /* DMA channel interrupt mask */
  70. u32 dma_chan_int_mask;
  71. /* DMA channel register width */
  72. unsigned int dma_chan_width;
  73. /* DMA engine has internal SRAM */
  74. bool dma_has_sram;
  75. };
  76. int __init bcm63xx_enet_register(int unit,
  77. const struct bcm63xx_enet_platform_data *pd);
  78. int bcm63xx_enetsw_register(const struct bcm63xx_enetsw_platform_data *pd);
  79. enum bcm63xx_regs_enetdmac {
  80. ENETDMAC_CHANCFG,
  81. ENETDMAC_IR,
  82. ENETDMAC_IRMASK,
  83. ENETDMAC_MAXBURST,
  84. ENETDMAC_BUFALLOC,
  85. ENETDMAC_RSTART,
  86. ENETDMAC_FC,
  87. ENETDMAC_LEN,
  88. };
  89. static inline unsigned long bcm63xx_enetdmacreg(enum bcm63xx_regs_enetdmac reg)
  90. {
  91. extern const unsigned long *bcm63xx_regs_enetdmac;
  92. return bcm63xx_regs_enetdmac[reg];
  93. }
  94. #endif /* ! BCM63XX_DEV_ENET_H_ */