Lan743/6.1 vanilla driver of Lan7431 from upstream

Adding 6.1.9 unmodified Lan7431 driver to nvidia-oot

This is the unmodified driver from
  K6.1.9
without our NVIDIA specific changes

Bug 3978997

Signed-off-by: Jeremy Alves <jalves@nvidia.com>
Change-Id: Iaf453a1b9dc82355f8c7936823c5c90633fe24d9
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2934591
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jeremy Alves
2023-07-11 10:58:05 -07:00
committed by mobile promotions
parent fa591a862a
commit 0df8edb69b
7 changed files with 8089 additions and 5 deletions

View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/* Copyright (C) 2018 Microchip Technology Inc. */
#ifndef _LAN743X_ETHTOOL_H
#define _LAN743X_ETHTOOL_H
#include "linux/ethtool.h"
#define LAN743X_ETH_REG_VERSION 1
enum {
ETH_PRIV_FLAGS,
ETH_ID_REV,
ETH_FPGA_REV,
ETH_STRAP_READ,
ETH_INT_STS,
ETH_HW_CFG,
ETH_PMT_CTL,
ETH_E2P_CMD,
ETH_E2P_DATA,
ETH_MAC_CR,
ETH_MAC_RX,
ETH_MAC_TX,
ETH_FLOW,
ETH_MII_ACC,
ETH_MII_DATA,
ETH_EEE_TX_LPI_REQ_DLY,
ETH_WUCSR,
ETH_WK_SRC,
/* Add new registers above */
MAX_LAN743X_ETH_REGS
};
extern const struct ethtool_ops lan743x_ethtool_ops;
#endif /* _LAN743X_ETHTOOL_H */

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,101 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/* Copyright (C) 2018 Microchip Technology Inc. */
#ifndef _LAN743X_PTP_H
#define _LAN743X_PTP_H
#include "linux/ptp_clock_kernel.h"
#include "linux/netdevice.h"
#define LAN7430_N_LED 4
#define LAN7430_N_GPIO 4 /* multiplexed with PHY LEDs */
#define LAN7431_N_GPIO 12
#define LAN743X_PTP_N_GPIO LAN7431_N_GPIO
/* the number of periodic outputs is limited by number of
* PTP clock event channels
*/
#define LAN743X_PTP_N_EVENT_CHAN 2
#define LAN743X_PTP_N_PEROUT LAN743X_PTP_N_EVENT_CHAN
#define LAN743X_PTP_N_EXTTS 4
#define LAN743X_PTP_N_PPS 0
#define PCI11X1X_PTP_IO_MAX_CHANNELS 8
struct lan743x_adapter;
/* GPIO */
struct lan743x_gpio {
/* gpio_lock: used to prevent concurrent access to gpio settings */
spinlock_t gpio_lock;
int used_bits;
int output_bits;
int ptp_bits;
u32 gpio_cfg0;
u32 gpio_cfg1;
u32 gpio_cfg2;
u32 gpio_cfg3;
};
int lan743x_gpio_init(struct lan743x_adapter *adapter);
void lan743x_ptp_isr(void *context);
bool lan743x_ptp_request_tx_timestamp(struct lan743x_adapter *adapter);
void lan743x_ptp_unrequest_tx_timestamp(struct lan743x_adapter *adapter);
void lan743x_ptp_tx_timestamp_skb(struct lan743x_adapter *adapter,
struct sk_buff *skb, bool ignore_sync);
int lan743x_ptp_init(struct lan743x_adapter *adapter);
int lan743x_ptp_open(struct lan743x_adapter *adapter);
void lan743x_ptp_close(struct lan743x_adapter *adapter);
void lan743x_ptp_update_latency(struct lan743x_adapter *adapter,
u32 link_speed);
int lan743x_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd);
#define LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS (4)
#define PTP_FLAG_PTP_CLOCK_REGISTERED BIT(1)
#define PTP_FLAG_ISR_ENABLED BIT(2)
struct lan743x_ptp_perout {
int event_ch; /* PTP event channel (0=channel A, 1=channel B) */
int gpio_pin; /* GPIO pin where output appears */
};
struct lan743x_extts {
int flags;
struct timespec64 ts;
};
struct lan743x_ptp {
int flags;
/* command_lock: used to prevent concurrent ptp commands */
struct mutex command_lock;
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_clock_info;
struct ptp_pin_desc pin_config[LAN743X_PTP_N_GPIO];
unsigned long used_event_ch;
struct lan743x_ptp_perout perout[LAN743X_PTP_N_PEROUT];
int ptp_io_perout[LAN743X_PTP_N_PEROUT]; /* PTP event channel (0=channel A, 1=channel B) */
struct lan743x_extts extts[LAN743X_PTP_N_EXTTS];
bool leds_multiplexed;
bool led_enabled[LAN7430_N_LED];
/* tx_ts_lock: used to prevent concurrent access to timestamp arrays */
spinlock_t tx_ts_lock;
int pending_tx_timestamps;
struct sk_buff *tx_ts_skb_queue[LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS];
unsigned int tx_ts_ignore_sync_queue;
int tx_ts_skb_queue_size;
u32 tx_ts_seconds_queue[LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS];
u32 tx_ts_nseconds_queue[LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS];
u32 tx_ts_header_queue[LAN743X_PTP_NUMBER_OF_TX_TIMESTAMPS];
int tx_ts_queue_size;
};
#endif /* _LAN743X_PTP_H */

View File

@@ -11,10 +11,10 @@ ifeq ($(PATCHLEVEL), 15)
endif #PATCHLEVEL
#when adding 6.1, uncomment below
#else ifeq ($(VERSION), 6)
#ifeq ($(PATCHLEVEL), 1)
#obj-m += lan743x.o
#lan743x-objs += 6.1/lan743x_main.o 6.1/lan743x_ethtool.o 6.1/lan743x_ptp.o
#endif #PATCHLEVEL
else ifeq ($(VERSION), 6)
ifeq ($(PATCHLEVEL), 1)
obj-m += lan743x.o
lan743x-objs += 6.1/lan743x_main.o 6.1/lan743x_ethtool.o 6.1/lan743x_ptp.o
endif #PATCHLEVEL
endif #VERSION