Commit 7e09a052 authored by Biju Das's avatar Biju Das Committed by David S. Miller

ravb: Exclude gPTP feature support for RZ/G2L

R-Car supports gPTP feature whereas RZ/G2L does not support it.
This patch excludes gtp feature support for RZ/G2L.
Signed-off-by: default avatarBiju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: default avatarLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 660e3d95
...@@ -1403,6 +1403,7 @@ static int ravb_get_ts_info(struct net_device *ndev, ...@@ -1403,6 +1403,7 @@ static int ravb_get_ts_info(struct net_device *ndev,
struct ethtool_ts_info *info) struct ethtool_ts_info *info)
{ {
struct ravb_private *priv = netdev_priv(ndev); struct ravb_private *priv = netdev_priv(ndev);
const struct ravb_hw_info *hw_info = priv->info;
info->so_timestamping = info->so_timestamping =
SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_TX_SOFTWARE |
...@@ -1416,6 +1417,7 @@ static int ravb_get_ts_info(struct net_device *ndev, ...@@ -1416,6 +1417,7 @@ static int ravb_get_ts_info(struct net_device *ndev,
(1 << HWTSTAMP_FILTER_NONE) | (1 << HWTSTAMP_FILTER_NONE) |
(1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) | (1 << HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
(1 << HWTSTAMP_FILTER_ALL); (1 << HWTSTAMP_FILTER_ALL);
if (hw_info->gptp || hw_info->ccc_gac)
info->phc_index = ptp_clock_index(priv->ptp.clock); info->phc_index = ptp_clock_index(priv->ptp.clock);
return 0; return 0;
...@@ -1640,6 +1642,7 @@ static void ravb_tx_timeout_work(struct work_struct *work) ...@@ -1640,6 +1642,7 @@ static void ravb_tx_timeout_work(struct work_struct *work)
static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev) static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{ {
struct ravb_private *priv = netdev_priv(ndev); struct ravb_private *priv = netdev_priv(ndev);
const struct ravb_hw_info *info = priv->info;
unsigned int num_tx_desc = priv->num_tx_desc; unsigned int num_tx_desc = priv->num_tx_desc;
u16 q = skb_get_queue_mapping(skb); u16 q = skb_get_queue_mapping(skb);
struct ravb_tstamp_skb *ts_skb; struct ravb_tstamp_skb *ts_skb;
...@@ -1716,6 +1719,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1716,6 +1719,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
desc->dptr = cpu_to_le32(dma_addr); desc->dptr = cpu_to_le32(dma_addr);
/* TX timestamp required */ /* TX timestamp required */
if (info->gptp || info->ccc_gac) {
if (q == RAVB_NC) { if (q == RAVB_NC) {
ts_skb = kmalloc(sizeof(*ts_skb), GFP_ATOMIC); ts_skb = kmalloc(sizeof(*ts_skb), GFP_ATOMIC);
if (!ts_skb) { if (!ts_skb) {
...@@ -1738,6 +1742,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev) ...@@ -1738,6 +1742,7 @@ static netdev_tx_t ravb_start_xmit(struct sk_buff *skb, struct net_device *ndev)
} }
skb_tx_timestamp(skb); skb_tx_timestamp(skb);
}
/* Descriptor type must be set after all the above writes */ /* Descriptor type must be set after all the above writes */
dma_wmb(); dma_wmb();
if (num_tx_desc > 1) { if (num_tx_desc > 1) {
...@@ -1858,11 +1863,13 @@ static int ravb_close(struct net_device *ndev) ...@@ -1858,11 +1863,13 @@ static int ravb_close(struct net_device *ndev)
"device will be stopped after h/w processes are done.\n"); "device will be stopped after h/w processes are done.\n");
/* Clear the timestamp list */ /* Clear the timestamp list */
if (info->gptp || info->ccc_gac) {
list_for_each_entry_safe(ts_skb, ts_skb2, &priv->ts_skb_list, list) { list_for_each_entry_safe(ts_skb, ts_skb2, &priv->ts_skb_list, list) {
list_del(&ts_skb->list); list_del(&ts_skb->list);
kfree_skb(ts_skb->skb); kfree_skb(ts_skb->skb);
kfree(ts_skb); kfree(ts_skb);
} }
}
/* PHY disconnect */ /* PHY disconnect */
if (ndev->phydev) { if (ndev->phydev) {
...@@ -2207,9 +2214,11 @@ static void ravb_set_config_mode(struct net_device *ndev) ...@@ -2207,9 +2214,11 @@ static void ravb_set_config_mode(struct net_device *ndev)
ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG); ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG);
/* Set CSEL value */ /* Set CSEL value */
ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB); ravb_modify(ndev, CCC, CCC_CSEL, CCC_CSEL_HPB);
} else { } else if (info->ccc_gac) {
ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG | ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG |
CCC_GAC | CCC_CSEL_HPB); CCC_GAC | CCC_CSEL_HPB);
} else {
ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_CONFIG);
} }
} }
...@@ -2395,6 +2404,7 @@ static int ravb_probe(struct platform_device *pdev) ...@@ -2395,6 +2404,7 @@ static int ravb_probe(struct platform_device *pdev)
/* Set AVB config mode */ /* Set AVB config mode */
ravb_set_config_mode(ndev); ravb_set_config_mode(ndev);
if (info->gptp || info->ccc_gac) {
/* Set GTI value */ /* Set GTI value */
error = ravb_set_gti(ndev); error = ravb_set_gti(ndev);
if (error) if (error)
...@@ -2402,6 +2412,7 @@ static int ravb_probe(struct platform_device *pdev) ...@@ -2402,6 +2412,7 @@ static int ravb_probe(struct platform_device *pdev)
/* Request GTI loading */ /* Request GTI loading */
ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
}
if (info->internal_delay) { if (info->internal_delay) {
ravb_parse_delay_mode(np, ndev); ravb_parse_delay_mode(np, ndev);
...@@ -2602,6 +2613,7 @@ static int __maybe_unused ravb_resume(struct device *dev) ...@@ -2602,6 +2613,7 @@ static int __maybe_unused ravb_resume(struct device *dev)
/* Set AVB config mode */ /* Set AVB config mode */
ravb_set_config_mode(ndev); ravb_set_config_mode(ndev);
if (info->gptp || info->ccc_gac) {
/* Set GTI value */ /* Set GTI value */
ret = ravb_set_gti(ndev); ret = ravb_set_gti(ndev);
if (ret) if (ret)
...@@ -2609,6 +2621,7 @@ static int __maybe_unused ravb_resume(struct device *dev) ...@@ -2609,6 +2621,7 @@ static int __maybe_unused ravb_resume(struct device *dev)
/* Request GTI loading */ /* Request GTI loading */
ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI); ravb_modify(ndev, GCCR, GCCR_LTI, GCCR_LTI);
}
if (info->internal_delay) if (info->internal_delay)
ravb_set_delay_mode(ndev); ravb_set_delay_mode(ndev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment