diff --git a/drivers/net/ethernet/nvidia/nvethernet/Makefile b/drivers/net/ethernet/nvidia/nvethernet/Makefile index 59770cb5..c1d6ba0f 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/Makefile +++ b/drivers/net/ethernet/nvidia/nvethernet/Makefile @@ -18,7 +18,7 @@ OSI_DMA := nvethernetrm/osi/dma obj-$(CONFIG_NVETHERNET) += nvethernet.o -ccflags-y += -DTHERMAL_CAL -DLINUX_IVC -I$(srctree.nvidia)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/include \ +ccflags-y += -DLINUX_IVC -I$(srctree.nvidia)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/include \ -I$(srctree.nvidia)/drivers/net/ethernet/nvidia/nvethernet/nvethernetrm/osi/common/include ccflags-y += -DMACSEC_SUPPORT -DNET30 -DMACSEC_DEBUG diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c index c82ffb78..111b3418 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c @@ -2116,145 +2116,6 @@ error_alloc: return ret; } -#ifdef THERMAL_CAL -/** - * @brief Set current thermal state. - * - * Algorithm: Fill the max supported thermal state for ethernet cooling - * device in variable provided by caller. - * - * @param[in] tcd: Ethernet thermal cooling device pointer. - * @param[in] state: Variable to read max thermal state. - * - * @note MAC needs to be out of reset. Once cooling device ops are - * registered, it can be called anytime from kernel. MAC has to be in - * sufficient state to allow pad calibration. - * - * return: 0 - succcess. Does not fail as function is only reading variable. - */ -static int ether_get_max_therm_state(struct thermal_cooling_device *tcd, - unsigned long *state) -{ - *state = ETHER_MAX_THERM_STATE; - - return 0; -} - -/** - * @brief Get current thermal state. - * - * Algorithm: Atomically get the current thermal state of etherent - * cooling device. - * - * @param[in] tcd: Ethernet thermal cooling device pointer. - * @param[in] state: Variable to read current thermal state. - * - * @note MAC needs to be out of reset. Once cooling device ops are - * registered, it can be called anytime from kernel. MAC has to be in - * sufficient state to allow pad calibration. - * - * @return: succcess on 0. - */ -static int ether_get_cur_therm_state(struct thermal_cooling_device *tcd, - unsigned long *state) -{ - struct ether_priv_data *pdata = tcd->devdata; - - *state = (unsigned long)atomic_read(&pdata->therm_state); - - return 0; -} - -/** - * @brief Set current thermal state. - * - * Algorithm: Atomically set the desired state provided as argument. - * Trigger pad calibration for each state change. - * - * @param[in] tcd: Ethernet thermal cooling device pointer. - * @param[in] state: The thermal state to set. - * - * @note MAC needs to be out of reset. Once cooling device ops are - * registered, it can be called anytime from kernel. MAC has to be in - * sufficient state to allow pad calibration. - * - * @retval 0 on success - * @retval negative value on failure. - */ -static int ether_set_cur_therm_state(struct thermal_cooling_device *tcd, - unsigned long state) -{ - struct ether_priv_data *pdata = tcd->devdata; - struct device *dev = pdata->dev; - struct osi_ioctl ioctl_data = {}; - - - /* Thermal framework will take care of making sure state is within - * valid bounds, based on the get_max_state callback. So no need - * to validate bounds again here. - */ - dev_info(dev, "Therm state change from %d to %lu\n", - atomic_read(&pdata->therm_state), state); - - atomic_set(&pdata->therm_state, state); - - ioctl_data.cmd = OSI_CMD_PAD_CALIBRATION; - if (osi_handle_ioctl(pdata->osi_core, &ioctl_data) < 0) { - dev_err(dev, "Therm state changed, failed pad calibration\n"); - return -1; - } - - return 0; -} - -static struct thermal_cooling_device_ops ether_cdev_ops = { - .get_max_state = ether_get_max_therm_state, - .get_cur_state = ether_get_cur_therm_state, - .set_cur_state = ether_set_cur_therm_state, -}; - -/** - * @brief Register thermal cooling device with kernel. - * - * Algorithm: Register thermal cooling device read from DT. The cooling - * device ops struct passed as argument will be used by thermal framework - * to callback the ethernet driver when temperature trip points are - * triggered, so that ethernet driver can do pad calibration. - * - * @param[in] pdata: Pointer to driver private data structure. - * - * @ote MAC needs to be out of reset. Once cooling device ops are - * registered, it can be called anytime from kernel. MAC has to be in - * sufficient state to allow pad calibration. - * - * @retval 0 on success - * @retval negative value on failure. - */ -static int ether_therm_init(struct ether_priv_data *pdata) -{ - struct device_node *np = NULL; - - if (pdata->osi_core->pre_si) - return 0; - - np = of_find_node_by_name(NULL, "eqos-cool-dev"); - if (!np) { - dev_err(pdata->dev, "failed to get eqos-cool-dev\n"); - return -ENODEV; - } - pdata->tcd = thermal_of_cooling_device_register(np, - "tegra-eqos", pdata, - ðer_cdev_ops); - if (!pdata->tcd) { - return -ENODEV; - } else if (IS_ERR(pdata->tcd)) { - return PTR_ERR(pdata->tcd); - } - - return 0; -} -#endif /* THERMAL_CAL */ - /** * @brief Initialize default EEE LPI configurations * @@ -2432,16 +2293,6 @@ static int ether_open(struct net_device *dev) goto err_alloc; } -#ifdef THERMAL_CAL - atomic_set(&pdata->therm_state, 0); - ret = ether_therm_init(pdata); - if (ret < 0) { - dev_err(pdata->dev, "Failed to register cooling device (%d)\n", - ret); - goto err_therm; - } -#endif /* THERMAL_CAL */ - /* initialize MAC/MTL/DMA Common registers */ ret = osi_hw_core_init(pdata->osi_core, pdata->hw_feat.tx_fifo_size, @@ -2548,10 +2399,6 @@ err_r_irq: ether_napi_disable(pdata); ether_ptp_remove(pdata); err_hw_init: -#ifdef THERMAL_CAL - thermal_cooling_device_unregister(pdata->tcd); -err_therm: -#endif /* THERMAL_CAL */ free_dma_resources(pdata); err_alloc: if (pdata->phydev) { @@ -2773,10 +2620,6 @@ static int ether_close(struct net_device *ndev) /* DMA De init */ osi_hw_dma_deinit(pdata->osi_dma); -#ifdef THERMAL_CAL - thermal_cooling_device_unregister(pdata->tcd); -#endif /* THERMAL_CAL */ - ether_napi_disable(pdata); /* free DMA resources after DMA stop */ diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h index fd15e9d9..d66e1d6b 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.h @@ -247,13 +247,6 @@ static inline int ether_avail_txdesc_cnt(struct osi_tx_ring *tx_ring) (TX_DESC_CNT - 1)); } -#ifdef THERMAL_CAL -/* @brief The DT binding for ethernet device has 5 thermal zones in steps of - * 35 degress from -40C to 110C. Each zone corresponds to a state. - */ -#define ETHER_MAX_THERM_STATE 5UL -#endif /* THERMAL_CAL */ - /** * @brief Timer to trigger Work queue periodically which read HW counters * and store locally. If data is at line rate, 2^32 entry get will filled in @@ -443,17 +436,6 @@ struct ether_priv_data { unsigned int mac_loopback_mode; /** Array of MTL queue TX priority */ unsigned int txq_prio[OSI_MGBE_MAX_NUM_CHANS]; - -#ifdef THERMAL_CAL - /** Pointer to thermal cooling device which this driver registers - * with the kernel. Kernel will invoke the callback ops for this - * cooling device when temperate in thermal zone defined in DT - * binding for this driver is tripped */ - struct thermal_cooling_device *tcd; - /** Atomic variable to hold the current temperature zone - * whcih has triggered */ - atomic_t therm_state; -#endif /* THERMAL_CAL */ /** Spin lock for Tx/Rx interrupt enable registers */ raw_spinlock_t rlock; /** max address register count, 2*mac_addr64_sel */