mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-23 17:55:05 +03:00
nvethernet: bringup on kernel-5.4
disable chip-id.h APIs on kernel-5.4 since the file is still not available. Back compatible with older kernel versions Bug 200591808 Change-Id: Ib991ad02ba016ac9f186b5c8afdc8608c780d9be Signed-off-by: Bibhay Ranjan <bibhayr@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2304494 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Revanth Kumar Uppala
parent
e42f49ee42
commit
619f3c7b7d
@@ -379,7 +379,12 @@ static int ether_phy_init(struct net_device *dev)
|
|||||||
{
|
{
|
||||||
struct ether_priv_data *pdata = netdev_priv(dev);
|
struct ether_priv_data *pdata = netdev_priv(dev);
|
||||||
struct phy_device *phydev = NULL;
|
struct phy_device *phydev = NULL;
|
||||||
|
#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
|
||||||
|
const unsigned int long supported = (SUPPORTED_Pause |
|
||||||
|
SUPPORTED_Asym_Pause);
|
||||||
|
const unsigned int long not_supported = ~(SUPPORTED_Pause |
|
||||||
|
SUPPORTED_Asym_Pause);
|
||||||
|
#endif
|
||||||
pdata->oldlink = 0;
|
pdata->oldlink = 0;
|
||||||
pdata->speed = SPEED_UNKNOWN;
|
pdata->speed = SPEED_UNKNOWN;
|
||||||
pdata->oldduplex = SPEED_UNKNOWN;
|
pdata->oldduplex = SPEED_UNKNOWN;
|
||||||
@@ -405,11 +410,27 @@ static int ether_phy_init(struct net_device *dev)
|
|||||||
* in PHY driver, handle this in eqos driver so that enabling/disabling
|
* in PHY driver, handle this in eqos driver so that enabling/disabling
|
||||||
* of the pause frame feature can be controlled based on the platform
|
* of the pause frame feature can be controlled based on the platform
|
||||||
*/
|
*/
|
||||||
phydev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
|
|
||||||
if (pdata->osi_core->pause_frames == OSI_PAUSE_FRAMES_DISABLE)
|
|
||||||
phydev->supported &= ~(SUPPORTED_Pause | SUPPORTED_Asym_Pause);
|
|
||||||
|
|
||||||
|
#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
|
||||||
|
linkmode_or(phydev->supported, phydev->supported,
|
||||||
|
&supported);
|
||||||
|
#else
|
||||||
|
phydev->supported |= (SUPPORTED_Pause | SUPPORTED_Asym_Pause);
|
||||||
|
#endif
|
||||||
|
if (pdata->osi_core->pause_frames == OSI_PAUSE_FRAMES_DISABLE)
|
||||||
|
#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
|
||||||
|
linkmode_and(phydev->supported,
|
||||||
|
phydev->supported,
|
||||||
|
¬_supported);
|
||||||
|
#else
|
||||||
|
phydev->supported &= ~(SUPPORTED_Pause | SUPPORTED_Asym_Pause);
|
||||||
|
#endif
|
||||||
|
#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
|
||||||
|
linkmode_copy(phydev->advertising,
|
||||||
|
phydev->supported);
|
||||||
|
#else
|
||||||
phydev->advertising = phydev->supported;
|
phydev->advertising = phydev->supported;
|
||||||
|
#endif
|
||||||
|
|
||||||
pdata->phydev = phydev;
|
pdata->phydev = phydev;
|
||||||
|
|
||||||
@@ -1027,10 +1048,10 @@ static int allocate_rx_dma_resource(struct osi_dma_priv_data *osi_dma,
|
|||||||
dev_err(dev, "failed to allocate Rx ring\n");
|
dev_err(dev, "failed to allocate Rx ring\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
osi_dma->rx_ring[chan]->rx_desc = dma_alloc_coherent(dev, rx_desc_size,
|
||||||
osi_dma->rx_ring[chan]->rx_desc = dma_zalloc_coherent(dev, rx_desc_size,
|
|
||||||
(dma_addr_t *)&osi_dma->rx_ring[chan]->rx_desc_phy_addr,
|
(dma_addr_t *)&osi_dma->rx_ring[chan]->rx_desc_phy_addr,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL | __GFP_ZERO);
|
||||||
|
|
||||||
if (osi_dma->rx_ring[chan]->rx_desc == NULL) {
|
if (osi_dma->rx_ring[chan]->rx_desc == NULL) {
|
||||||
dev_err(dev, "failed to allocate receive descriptor\n");
|
dev_err(dev, "failed to allocate receive descriptor\n");
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
@@ -1215,10 +1236,10 @@ static int allocate_tx_dma_resource(struct osi_dma_priv_data *osi_dma,
|
|||||||
dev_err(dev, "failed to allocate Tx ring\n");
|
dev_err(dev, "failed to allocate Tx ring\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
osi_dma->tx_ring[chan]->tx_desc = dma_alloc_coherent(dev, tx_desc_size,
|
||||||
osi_dma->tx_ring[chan]->tx_desc = dma_zalloc_coherent(dev, tx_desc_size,
|
|
||||||
(dma_addr_t *)&osi_dma->tx_ring[chan]->tx_desc_phy_addr,
|
(dma_addr_t *)&osi_dma->tx_ring[chan]->tx_desc_phy_addr,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL | __GFP_ZERO);
|
||||||
|
|
||||||
if (osi_dma->tx_ring[chan]->tx_desc == NULL) {
|
if (osi_dma->tx_ring[chan]->tx_desc == NULL) {
|
||||||
dev_err(dev, "failed to allocate transmit descriptor\n");
|
dev_err(dev, "failed to allocate transmit descriptor\n");
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
@@ -1880,7 +1901,11 @@ static int ether_tx_swcx_alloc(struct device *dev,
|
|||||||
struct osi_tx_swcx *tx_swcx = NULL;
|
struct osi_tx_swcx *tx_swcx = NULL;
|
||||||
unsigned int len = 0, offset = 0, size = 0;
|
unsigned int len = 0, offset = 0, size = 0;
|
||||||
int cnt = 0, ret = 0, i, num_frags;
|
int cnt = 0, ret = 0, i, num_frags;
|
||||||
|
#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
|
||||||
|
skb_frag_t *frag;
|
||||||
|
#else
|
||||||
struct skb_frag_struct *frag;
|
struct skb_frag_struct *frag;
|
||||||
|
#endif
|
||||||
unsigned int page_idx, page_offset;
|
unsigned int page_idx, page_offset;
|
||||||
unsigned int max_data_len_per_txd = (unsigned int)
|
unsigned int max_data_len_per_txd = (unsigned int)
|
||||||
ETHER_TX_MAX_BUFF_SIZE;
|
ETHER_TX_MAX_BUFF_SIZE;
|
||||||
@@ -2009,11 +2034,19 @@ static int ether_tx_swcx_alloc(struct device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
size = min(len, max_data_len_per_txd);
|
size = min(len, max_data_len_per_txd);
|
||||||
|
#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
|
||||||
|
page_idx = (frag->bv_offset + offset) >> PAGE_SHIFT;
|
||||||
|
page_offset = (frag->bv_offset + offset) & ~PAGE_MASK;
|
||||||
|
#else
|
||||||
page_idx = (frag->page_offset + offset) >> PAGE_SHIFT;
|
page_idx = (frag->page_offset + offset) >> PAGE_SHIFT;
|
||||||
page_offset = (frag->page_offset + offset) & ~PAGE_MASK;
|
page_offset = (frag->page_offset + offset) & ~PAGE_MASK;
|
||||||
|
#endif
|
||||||
tx_swcx->buf_phy_addr = dma_map_page(dev,
|
tx_swcx->buf_phy_addr = dma_map_page(dev,
|
||||||
|
#if (KERNEL_VERSION(5, 4, 0) <= LINUX_VERSION_CODE)
|
||||||
|
(frag->bv_page + page_idx),
|
||||||
|
#else
|
||||||
(frag->page.p + page_idx),
|
(frag->page.p + page_idx),
|
||||||
|
#endif
|
||||||
page_offset, size,
|
page_offset, size,
|
||||||
DMA_TO_DEVICE);
|
DMA_TO_DEVICE);
|
||||||
if (unlikely(dma_mapping_error(dev,
|
if (unlikely(dma_mapping_error(dev,
|
||||||
@@ -4130,11 +4163,12 @@ static void init_filter_values(struct ether_priv_data *pdata)
|
|||||||
static inline void tegra_pre_si_platform(struct osi_core_priv_data *osi_core)
|
static inline void tegra_pre_si_platform(struct osi_core_priv_data *osi_core)
|
||||||
{
|
{
|
||||||
/* VDK set true for both VDK/uFPGA */
|
/* VDK set true for both VDK/uFPGA */
|
||||||
if (tegra_platform_is_vdk()) {
|
#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
|
||||||
|
if (tegra_platform_is_vdk())
|
||||||
osi_core->pre_si = 1;
|
osi_core->pre_si = 1;
|
||||||
} else {
|
else
|
||||||
|
#endif
|
||||||
osi_core->pre_si = 0;
|
osi_core->pre_si = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,8 +43,8 @@
|
|||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
|
#if (KERNEL_VERSION(5, 4, 0) > LINUX_VERSION_CODE)
|
||||||
#include <linux/tegra-ivc.h>
|
#include <linux/tegra-ivc.h>
|
||||||
#endif
|
|
||||||
#include <soc/tegra/chip-id.h>
|
#include <soc/tegra/chip-id.h>
|
||||||
|
#endif
|
||||||
#include <osi_core.h>
|
#include <osi_core.h>
|
||||||
#include <osi_dma.h>
|
#include <osi_dma.h>
|
||||||
#include <mmc.h>
|
#include <mmc.h>
|
||||||
|
|||||||
@@ -467,8 +467,13 @@ static void ether_get_pauseparam(struct net_device *ndev,
|
|||||||
|
|
||||||
/* return if pause frame is not supported */
|
/* return if pause frame is not supported */
|
||||||
if ((pdata->osi_core->pause_frames == OSI_PAUSE_FRAMES_DISABLE) ||
|
if ((pdata->osi_core->pause_frames == OSI_PAUSE_FRAMES_DISABLE) ||
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
|
||||||
|
(!linkmode_test_bit(SUPPORTED_Pause, phydev->supported) ||
|
||||||
|
!linkmode_test_bit(SUPPORTED_Asym_Pause, phydev->supported))) {
|
||||||
|
#else
|
||||||
(!(phydev->supported & SUPPORTED_Pause) ||
|
(!(phydev->supported & SUPPORTED_Pause) ||
|
||||||
!(phydev->supported & SUPPORTED_Asym_Pause))) {
|
!(phydev->supported & SUPPORTED_Asym_Pause))) {
|
||||||
|
#endif
|
||||||
dev_err(pdata->dev, "FLOW control not supported\n");
|
dev_err(pdata->dev, "FLOW control not supported\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -517,8 +522,13 @@ static int ether_set_pauseparam(struct net_device *ndev,
|
|||||||
|
|
||||||
/* return if pause frame is not supported */
|
/* return if pause frame is not supported */
|
||||||
if ((pdata->osi_core->pause_frames == OSI_PAUSE_FRAMES_DISABLE) ||
|
if ((pdata->osi_core->pause_frames == OSI_PAUSE_FRAMES_DISABLE) ||
|
||||||
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
|
||||||
|
(!linkmode_test_bit(SUPPORTED_Pause, phydev->supported) ||
|
||||||
|
!linkmode_test_bit(SUPPORTED_Asym_Pause, phydev->supported))) {
|
||||||
|
#else
|
||||||
(!(phydev->supported & SUPPORTED_Pause) ||
|
(!(phydev->supported & SUPPORTED_Pause) ||
|
||||||
!(phydev->supported & SUPPORTED_Asym_Pause))) {
|
!(phydev->supported & SUPPORTED_Asym_Pause))) {
|
||||||
|
#endif
|
||||||
dev_err(pdata->dev, "FLOW control not supported\n");
|
dev_err(pdata->dev, "FLOW control not supported\n");
|
||||||
return -EOPNOTSUPP;
|
return -EOPNOTSUPP;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ struct ifr_data_timestamp_struct {
|
|||||||
/** Clock ID */
|
/** Clock ID */
|
||||||
clockid_t clockid;
|
clockid_t clockid;
|
||||||
/** Store kernel time */
|
/** Store kernel time */
|
||||||
struct timespec kernel_ts;
|
struct timespec64 kernel_ts;
|
||||||
/** Store HW time */
|
/** Store HW time */
|
||||||
struct timespec hw_ptp_ts;
|
struct timespec hw_ptp_ts;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
|
* Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
* under the terms and conditions of the GNU General Public License,
|
* under the terms and conditions of the GNU General Public License,
|
||||||
@@ -138,7 +138,7 @@ static int ether_adjust_freq(struct ptp_clock_info *ptp, s32 ppb)
|
|||||||
* @retval 0 on success
|
* @retval 0 on success
|
||||||
* @retval "negative value" on failure.
|
* @retval "negative value" on failure.
|
||||||
*/
|
*/
|
||||||
static int ether_get_time(struct ptp_clock_info *ptp, struct timespec *ts)
|
static int ether_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts)
|
||||||
{
|
{
|
||||||
struct ether_priv_data *pdata = container_of(ptp,
|
struct ether_priv_data *pdata = container_of(ptp,
|
||||||
struct ether_priv_data,
|
struct ether_priv_data,
|
||||||
@@ -172,7 +172,7 @@ static int ether_get_time(struct ptp_clock_info *ptp, struct timespec *ts)
|
|||||||
* @retval "negative value" on failure.
|
* @retval "negative value" on failure.
|
||||||
*/
|
*/
|
||||||
static int ether_set_time(struct ptp_clock_info *ptp,
|
static int ether_set_time(struct ptp_clock_info *ptp,
|
||||||
const struct timespec *ts)
|
const struct timespec64 *ts)
|
||||||
{
|
{
|
||||||
struct ether_priv_data *pdata = container_of(ptp,
|
struct ether_priv_data *pdata = container_of(ptp,
|
||||||
struct ether_priv_data,
|
struct ether_priv_data,
|
||||||
@@ -495,11 +495,11 @@ int ether_handle_priv_ts_ioctl(struct ether_priv_data *pdata,
|
|||||||
raw_spin_lock_irqsave(ðer_ts_lock, flags);
|
raw_spin_lock_irqsave(ðer_ts_lock, flags);
|
||||||
switch (req.clockid) {
|
switch (req.clockid) {
|
||||||
case CLOCK_REALTIME:
|
case CLOCK_REALTIME:
|
||||||
ktime_get_real_ts(&req.kernel_ts);
|
ktime_get_real_ts64(&req.kernel_ts);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLOCK_MONOTONIC:
|
case CLOCK_MONOTONIC:
|
||||||
ktime_get_ts(&req.kernel_ts);
|
ktime_get_ts64(&req.kernel_ts);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user