| .. | .. |
|---|
| 4 | 4 | #ifndef _LAN743X_H |
|---|
| 5 | 5 | #define _LAN743X_H |
|---|
| 6 | 6 | |
|---|
| 7 | +#include <linux/phy.h> |
|---|
| 7 | 8 | #include "lan743x_ptp.h" |
|---|
| 8 | 9 | |
|---|
| 9 | 10 | #define DRIVER_AUTHOR "Bryan Whitehead <Bryan.Whitehead@microchip.com>" |
|---|
| .. | .. |
|---|
| 26 | 27 | #define FPGA_REV_GET_MAJOR_(fpga_rev) ((fpga_rev) & 0x000000FF) |
|---|
| 27 | 28 | |
|---|
| 28 | 29 | #define HW_CFG (0x010) |
|---|
| 30 | +#define HW_CFG_RELOAD_TYPE_ALL_ (0x00000FC0) |
|---|
| 31 | +#define HW_CFG_EE_OTP_RELOAD_ BIT(4) |
|---|
| 29 | 32 | #define HW_CFG_LRST_ BIT(1) |
|---|
| 30 | 33 | |
|---|
| 31 | 34 | #define PMT_CTL (0x014) |
|---|
| .. | .. |
|---|
| 102 | 105 | ((value << 0) & FCT_FLOW_CTL_ON_THRESHOLD_) |
|---|
| 103 | 106 | |
|---|
| 104 | 107 | #define MAC_CR (0x100) |
|---|
| 108 | +#define MAC_CR_MII_EN_ BIT(19) |
|---|
| 105 | 109 | #define MAC_CR_EEE_EN_ BIT(17) |
|---|
| 106 | 110 | #define MAC_CR_ADD_ BIT(12) |
|---|
| 107 | 111 | #define MAC_CR_ASD_ BIT(11) |
|---|
| 108 | 112 | #define MAC_CR_CNTR_RST_ BIT(5) |
|---|
| 113 | +#define MAC_CR_DPX_ BIT(3) |
|---|
| 114 | +#define MAC_CR_CFG_H_ BIT(2) |
|---|
| 115 | +#define MAC_CR_CFG_L_ BIT(1) |
|---|
| 109 | 116 | #define MAC_CR_RST_ BIT(0) |
|---|
| 110 | 117 | |
|---|
| 111 | 118 | #define MAC_RX (0x104) |
|---|
| .. | .. |
|---|
| 453 | 460 | #define OTP_PWR_DN (0x1000) |
|---|
| 454 | 461 | #define OTP_PWR_DN_PWRDN_N_ BIT(0) |
|---|
| 455 | 462 | |
|---|
| 456 | | -#define OTP_ADDR1 (0x1004) |
|---|
| 457 | | -#define OTP_ADDR1_15_11_MASK_ (0x1F) |
|---|
| 458 | | - |
|---|
| 459 | | -#define OTP_ADDR2 (0x1008) |
|---|
| 460 | | -#define OTP_ADDR2_10_3_MASK_ (0xFF) |
|---|
| 463 | +#define OTP_ADDR_HIGH (0x1004) |
|---|
| 464 | +#define OTP_ADDR_LOW (0x1008) |
|---|
| 461 | 465 | |
|---|
| 462 | 466 | #define OTP_PRGM_DATA (0x1010) |
|---|
| 463 | 467 | |
|---|
| 464 | 468 | #define OTP_PRGM_MODE (0x1014) |
|---|
| 465 | 469 | #define OTP_PRGM_MODE_BYTE_ BIT(0) |
|---|
| 470 | + |
|---|
| 471 | +#define OTP_READ_DATA (0x1018) |
|---|
| 472 | + |
|---|
| 473 | +#define OTP_FUNC_CMD (0x1020) |
|---|
| 474 | +#define OTP_FUNC_CMD_READ_ BIT(0) |
|---|
| 466 | 475 | |
|---|
| 467 | 476 | #define OTP_TST_CMD (0x1024) |
|---|
| 468 | 477 | #define OTP_TST_CMD_PRGVRFY_ BIT(3) |
|---|
| .. | .. |
|---|
| 651 | 660 | |
|---|
| 652 | 661 | struct lan743x_tx_buffer_info *buffer_info; |
|---|
| 653 | 662 | |
|---|
| 654 | | - u32 *head_cpu_ptr; |
|---|
| 663 | + __le32 *head_cpu_ptr; |
|---|
| 655 | 664 | dma_addr_t head_dma_ptr; |
|---|
| 656 | 665 | int last_head; |
|---|
| 657 | 666 | int last_tail; |
|---|
| .. | .. |
|---|
| 681 | 690 | |
|---|
| 682 | 691 | struct lan743x_rx_buffer_info *buffer_info; |
|---|
| 683 | 692 | |
|---|
| 684 | | - u32 *head_cpu_ptr; |
|---|
| 693 | + __le32 *head_cpu_ptr; |
|---|
| 685 | 694 | dma_addr_t head_dma_ptr; |
|---|
| 686 | 695 | u32 last_head; |
|---|
| 687 | 696 | u32 last_tail; |
|---|
| .. | .. |
|---|
| 694 | 703 | struct lan743x_adapter { |
|---|
| 695 | 704 | struct net_device *netdev; |
|---|
| 696 | 705 | struct mii_bus *mdiobus; |
|---|
| 706 | + phy_interface_t phy_mode; |
|---|
| 697 | 707 | int msg_enable; |
|---|
| 698 | 708 | #ifdef CONFIG_PM |
|---|
| 699 | 709 | u32 wolopts; |
|---|
| .. | .. |
|---|
| 710 | 720 | struct lan743x_phy phy; |
|---|
| 711 | 721 | struct lan743x_tx tx[LAN743X_MAX_TX_CHANNELS]; |
|---|
| 712 | 722 | struct lan743x_rx rx[LAN743X_MAX_RX_CHANNELS]; |
|---|
| 723 | + |
|---|
| 724 | +#define LAN743X_ADAPTER_FLAG_OTP BIT(0) |
|---|
| 725 | + u32 flags; |
|---|
| 713 | 726 | }; |
|---|
| 714 | 727 | |
|---|
| 715 | 728 | #define LAN743X_COMPONENT_FLAG_RX(channel) BIT(20 + (channel)) |
|---|
| .. | .. |
|---|
| 762 | 775 | #define TX_DESC_DATA3_FRAME_LENGTH_MSS_MASK_ (0x3FFF0000) |
|---|
| 763 | 776 | |
|---|
| 764 | 777 | struct lan743x_tx_descriptor { |
|---|
| 765 | | - u32 data0; |
|---|
| 766 | | - u32 data1; |
|---|
| 767 | | - u32 data2; |
|---|
| 768 | | - u32 data3; |
|---|
| 778 | + __le32 data0; |
|---|
| 779 | + __le32 data1; |
|---|
| 780 | + __le32 data2; |
|---|
| 781 | + __le32 data3; |
|---|
| 769 | 782 | } __aligned(DEFAULT_DMA_DESCRIPTOR_SPACING); |
|---|
| 770 | 783 | |
|---|
| 771 | 784 | #define TX_BUFFER_INFO_FLAG_ACTIVE BIT(0) |
|---|
| .. | .. |
|---|
| 800 | 813 | #define RX_HEAD_PADDING NET_IP_ALIGN |
|---|
| 801 | 814 | |
|---|
| 802 | 815 | struct lan743x_rx_descriptor { |
|---|
| 803 | | - u32 data0; |
|---|
| 804 | | - u32 data1; |
|---|
| 805 | | - u32 data2; |
|---|
| 806 | | - u32 data3; |
|---|
| 816 | + __le32 data0; |
|---|
| 817 | + __le32 data1; |
|---|
| 818 | + __le32 data2; |
|---|
| 819 | + __le32 data3; |
|---|
| 807 | 820 | } __aligned(DEFAULT_DMA_DESCRIPTOR_SPACING); |
|---|
| 808 | 821 | |
|---|
| 809 | 822 | #define RX_BUFFER_INFO_FLAG_ACTIVE BIT(0) |
|---|