diff mbox

[net-next] ravb: ptp: Add CONFIG mode support

Message ID 1448989479-11594-1-git-send-email-ykaneko0929@gmail.com (mailing list archive)
State Accepted
Delegated to: Simon Horman
Headers show

Commit Message

Yoshihiro Kaneko Dec. 1, 2015, 5:04 p.m. UTC
From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>

This patch makes PTP support active in CONFIG mode on R-Car Gen3.

Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---

This patch is based on the master branch of David Miller's next networking
tree.

 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 33 +++++++++++++++++++++++++++-----
 2 files changed, 29 insertions(+), 5 deletions(-)

Comments

David Miller Dec. 3, 2015, 7:28 p.m. UTC | #1
From: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Date: Wed,  2 Dec 2015 02:04:39 +0900

> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> 
> This patch makes PTP support active in CONFIG mode on R-Car Gen3.
> 
> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>

Applied, thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 3, 2015, 9:09 p.m. UTC | #2
Hello.

On 12/01/2015 08:04 PM, Yoshihiro Kaneko wrote:

> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>
> This patch makes PTP support active in CONFIG mode on R-Car Gen3.
>
> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> ---
>
> This patch is based on the master branch of David Miller's next networking
> tree.
>
>   drivers/net/ethernet/renesas/ravb.h      |  1 +
>   drivers/net/ethernet/renesas/ravb_main.c | 33 +++++++++++++++++++++++++++-----
>   2 files changed, 29 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
> index f9dee74..9fbe92a 100644
> --- a/drivers/net/ethernet/renesas/ravb.h
> +++ b/drivers/net/ethernet/renesas/ravb.h
> @@ -206,6 +206,7 @@ enum CCC_BIT {
>   	CCC_OPC_RESET	= 0x00000000,
>   	CCC_OPC_CONFIG	= 0x00000001,
>   	CCC_OPC_OPERATION = 0x00000002,
> +	CCC_GAC		= 0x00000080,

    I'd have added a comment that it's gen3 specific.

[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 990dc55..293046d 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
> @@ -1814,6 +1825,10 @@ static int ravb_probe(struct platform_device *pdev)
>   	/* Initialise HW timestamp list */
>   	INIT_LIST_HEAD(&priv->ts_skb_list);
>
> +	/* Initialise PTP Clock driver */
> +	if (chip_id != RCAR_GEN2)
> +		ravb_ptp_init(ndev, pdev);
> +
>   	/* Debug message level */
>   	priv->msg_enable = RAVB_DEF_MSG_ENABLE;
>
> @@ -1855,6 +1870,10 @@ out_napi_del:
>   out_dma_free:
>   	dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
>   			  priv->desc_bat_dma);
> +
> +	/* Stop PTP Clock driver */
> +	if (chip_id != RCAR_GEN2)
> +		ravb_ptp_stop(ndev);

    This is clearly misplaced.

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 3, 2015, 9:10 p.m. UTC | #3
Hello.

On 12/03/2015 10:28 PM, David Miller wrote:

>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>
>> This patch makes PTP support active in CONFIG mode on R-Car Gen3.
>>
>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>
> Applied, thank you.

    You were too fast for me. Alas, I overlooked it. :-/
    Perhaps worth adding me to MAINTAINERS as (a new role of) a reviewer...

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 3, 2015, 11:08 p.m. UTC | #4
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Fri, 4 Dec 2015 00:10:56 +0300

>    Perhaps worth adding me to MAINTAINERS as (a new role of) a
>    reviewer...

I'll happily apply such a patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 3, 2015, 11:38 p.m. UTC | #5
On 12/04/2015 02:08 AM, David Miller wrote:

>>     Perhaps worth adding me to MAINTAINERS as (a new role of) a
>>     reviewer...
>
> I'll happily apply such a patch.

    OK, net.git would be OK as a base?

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Dec. 4, 2015, 1:36 a.m. UTC | #6
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Fri, 4 Dec 2015 02:38:30 +0300

> On 12/04/2015 02:08 AM, David Miller wrote:
> 
>>>     Perhaps worth adding me to MAINTAINERS as (a new role of) a
>>>     reviewer...
>>
>> I'll happily apply such a patch.
> 
>    OK, net.git would be OK as a base?

Absolutely.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yoshihiro Kaneko Dec. 5, 2015, 10:01 a.m. UTC | #7
Hello Sergei,

Thanks for your review.

2015-12-04 6:09 GMT+09:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
> On 12/01/2015 08:04 PM, Yoshihiro Kaneko wrote:
>
>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>
>> This patch makes PTP support active in CONFIG mode on R-Car Gen3.
>>
>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>> ---
>>
>> This patch is based on the master branch of David Miller's next networking
>> tree.
>>
>>   drivers/net/ethernet/renesas/ravb.h      |  1 +
>>   drivers/net/ethernet/renesas/ravb_main.c | 33
>> +++++++++++++++++++++++++++-----
>>   2 files changed, 29 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/renesas/ravb.h
>> b/drivers/net/ethernet/renesas/ravb.h
>> index f9dee74..9fbe92a 100644
>> --- a/drivers/net/ethernet/renesas/ravb.h
>> +++ b/drivers/net/ethernet/renesas/ravb.h
>> @@ -206,6 +206,7 @@ enum CCC_BIT {
>>         CCC_OPC_RESET   = 0x00000000,
>>         CCC_OPC_CONFIG  = 0x00000001,
>>         CCC_OPC_OPERATION = 0x00000002,
>> +       CCC_GAC         = 0x00000080,
>
>
>    I'd have added a comment that it's gen3 specific.
>
> [...]
>>
>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>> b/drivers/net/ethernet/renesas/ravb_main.c
>> index 990dc55..293046d 100644
>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>
> [...]
>>
>> @@ -1814,6 +1825,10 @@ static int ravb_probe(struct platform_device *pdev)
>>         /* Initialise HW timestamp list */
>>         INIT_LIST_HEAD(&priv->ts_skb_list);
>>
>> +       /* Initialise PTP Clock driver */
>> +       if (chip_id != RCAR_GEN2)
>> +               ravb_ptp_init(ndev, pdev);
>> +
>>         /* Debug message level */
>>         priv->msg_enable = RAVB_DEF_MSG_ENABLE;
>>
>> @@ -1855,6 +1870,10 @@ out_napi_del:
>>   out_dma_free:
>>         dma_free_coherent(ndev->dev.parent, priv->desc_bat_size,
>> priv->desc_bat,
>>                           priv->desc_bat_dma);
>> +
>> +       /* Stop PTP Clock driver */
>> +       if (chip_id != RCAR_GEN2)
>> +               ravb_ptp_stop(ndev);
>
>
>    This is clearly misplaced.

It's my fault.

>
> [...]
>
> MBR, Sergei
>

Regards,
Kaneko
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Dec. 6, 2015, 7:19 p.m. UTC | #8
Hello.

On 12/05/2015 01:01 PM, Yoshihiro Kaneko wrote:

> Thanks for your review.

    From now on, it'll be my duty. :-)

> 2015-12-04 6:09 GMT+09:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
>> Hello.
>>
>> On 12/01/2015 08:04 PM, Yoshihiro Kaneko wrote:
>>
>>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>>
>>> This patch makes PTP support active in CONFIG mode on R-Car Gen3.
>>>
>>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>>> ---
>>>
>>> This patch is based on the master branch of David Miller's next networking
>>> tree.
>>>
>>>    drivers/net/ethernet/renesas/ravb.h      |  1 +
>>>    drivers/net/ethernet/renesas/ravb_main.c | 33
>>> +++++++++++++++++++++++++++-----
>>>    2 files changed, 29 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/renesas/ravb.h
>>> b/drivers/net/ethernet/renesas/ravb.h
>>> index f9dee74..9fbe92a 100644
>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>> +++ b/drivers/net/ethernet/renesas/ravb.h
[...]

>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>>> b/drivers/net/ethernet/renesas/ravb_main.c
>>> index 990dc55..293046d 100644
>>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
[...]
>>> @@ -1855,6 +1870,10 @@ out_napi_del:
>>>    out_dma_free:
>>>          dma_free_coherent(ndev->dev.parent, priv->desc_bat_size,
>>> priv->desc_bat,
>>>                            priv->desc_bat_dma);
>>> +
>>> +       /* Stop PTP Clock driver */
>>> +       if (chip_id != RCAR_GEN2)
>>> +               ravb_ptp_stop(ndev);
>>
>>
>>     This is clearly misplaced.
>
> It's my fault.

    Should we expect a new patch fixing this issue?

[...]

> Regards,
> Kaneko

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yoshihiro Kaneko Dec. 7, 2015, 2:47 p.m. UTC | #9
Hello Sergei,

2015-12-07 4:19 GMT+09:00 Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>:
> Hello.
>
> On 12/05/2015 01:01 PM, Yoshihiro Kaneko wrote:
>
>> Thanks for your review.
>
>
>    From now on, it'll be my duty. :-)

Thank you always for your help.

>
>> 2015-12-04 6:09 GMT+09:00 Sergei Shtylyov
>> <sergei.shtylyov@cogentembedded.com>:
>>>
>>> Hello.
>>>
>>> On 12/01/2015 08:04 PM, Yoshihiro Kaneko wrote:
>>>
>>>> From: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>>>
>>>> This patch makes PTP support active in CONFIG mode on R-Car Gen3.
>>>>
>>>> Signed-off-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
>>>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>>>> ---
>>>>
>>>> This patch is based on the master branch of David Miller's next
>>>> networking
>>>> tree.
>>>>
>>>>    drivers/net/ethernet/renesas/ravb.h      |  1 +
>>>>    drivers/net/ethernet/renesas/ravb_main.c | 33
>>>> +++++++++++++++++++++++++++-----
>>>>    2 files changed, 29 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/renesas/ravb.h
>>>> b/drivers/net/ethernet/renesas/ravb.h
>>>> index f9dee74..9fbe92a 100644
>>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>>> +++ b/drivers/net/ethernet/renesas/ravb.h
>
> [...]
>
>>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>>>> b/drivers/net/ethernet/renesas/ravb_main.c
>>>> index 990dc55..293046d 100644
>>>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>
> [...]
>>>>
>>>> @@ -1855,6 +1870,10 @@ out_napi_del:
>>>>    out_dma_free:
>>>>          dma_free_coherent(ndev->dev.parent, priv->desc_bat_size,
>>>> priv->desc_bat,
>>>>                            priv->desc_bat_dma);
>>>> +
>>>> +       /* Stop PTP Clock driver */
>>>> +       if (chip_id != RCAR_GEN2)
>>>> +               ravb_ptp_stop(ndev);
>>>
>>>
>>>
>>>     This is clearly misplaced.
>>
>>
>> It's my fault.
>
>
>    Should we expect a new patch fixing this issue?

Sure, I will do.

>
> [...]
>
>> Regards,
>> Kaneko
>
>
> MBR, Sergei
>

Thanks,
Kaneko
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index f9dee74..9fbe92a 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -206,6 +206,7 @@  enum CCC_BIT {
 	CCC_OPC_RESET	= 0x00000000,
 	CCC_OPC_CONFIG	= 0x00000001,
 	CCC_OPC_OPERATION = 0x00000002,
+	CCC_GAC		= 0x00000080,
 	CCC_DTSR	= 0x00000100,
 	CCC_CSEL	= 0x00030000,
 	CCC_CSEL_HPB	= 0x00010000,
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 990dc55..293046d 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1231,7 +1231,8 @@  static int ravb_open(struct net_device *ndev)
 	ravb_emac_init(ndev);
 
 	/* Initialise PTP Clock driver */
-	ravb_ptp_init(ndev, priv->pdev);
+	if (priv->chip_id == RCAR_GEN2)
+		ravb_ptp_init(ndev, priv->pdev);
 
 	netif_tx_start_all_queues(ndev);
 
@@ -1244,7 +1245,8 @@  static int ravb_open(struct net_device *ndev)
 
 out_ptp_stop:
 	/* Stop PTP Clock driver */
-	ravb_ptp_stop(ndev);
+	if (priv->chip_id == RCAR_GEN2)
+		ravb_ptp_stop(ndev);
 out_free_irq:
 	free_irq(ndev->irq, ndev);
 	free_irq(priv->emac_irq, ndev);
@@ -1476,7 +1478,8 @@  static int ravb_close(struct net_device *ndev)
 	ravb_write(ndev, 0, TIC);
 
 	/* Stop PTP Clock driver */
-	ravb_ptp_stop(ndev);
+	if (priv->chip_id == RCAR_GEN2)
+		ravb_ptp_stop(ndev);
 
 	/* Set the config mode to stop the AVB-DMAC's processes */
 	if (ravb_stop_dma(ndev) < 0)
@@ -1781,8 +1784,16 @@  static int ravb_probe(struct platform_device *pdev)
 	ndev->ethtool_ops = &ravb_ethtool_ops;
 
 	/* Set AVB config mode */
-	ravb_write(ndev, (ravb_read(ndev, CCC) & ~CCC_OPC) | CCC_OPC_CONFIG,
-		   CCC);
+	if (chip_id == RCAR_GEN2) {
+		ravb_write(ndev, (ravb_read(ndev, CCC) & ~CCC_OPC) |
+			   CCC_OPC_CONFIG, CCC);
+		/* Set CSEL value */
+		ravb_write(ndev, (ravb_read(ndev, CCC) & ~CCC_CSEL) |
+			   CCC_CSEL_HPB, CCC);
+	} else {
+		ravb_write(ndev, (ravb_read(ndev, CCC) & ~CCC_OPC) |
+			   CCC_OPC_CONFIG | CCC_GAC | CCC_CSEL_HPB, CCC);
+	}
 
 	/* Set CSEL value */
 	ravb_write(ndev, (ravb_read(ndev, CCC) & ~CCC_CSEL) | CCC_CSEL_HPB,
@@ -1814,6 +1825,10 @@  static int ravb_probe(struct platform_device *pdev)
 	/* Initialise HW timestamp list */
 	INIT_LIST_HEAD(&priv->ts_skb_list);
 
+	/* Initialise PTP Clock driver */
+	if (chip_id != RCAR_GEN2)
+		ravb_ptp_init(ndev, pdev);
+
 	/* Debug message level */
 	priv->msg_enable = RAVB_DEF_MSG_ENABLE;
 
@@ -1855,6 +1870,10 @@  out_napi_del:
 out_dma_free:
 	dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
 			  priv->desc_bat_dma);
+
+	/* Stop PTP Clock driver */
+	if (chip_id != RCAR_GEN2)
+		ravb_ptp_stop(ndev);
 out_release:
 	if (ndev)
 		free_netdev(ndev);
@@ -1869,6 +1888,10 @@  static int ravb_remove(struct platform_device *pdev)
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct ravb_private *priv = netdev_priv(ndev);
 
+	/* Stop PTP Clock driver */
+	if (priv->chip_id != RCAR_GEN2)
+		ravb_ptp_stop(ndev);
+
 	dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
 			  priv->desc_bat_dma);
 	/* Set reset mode */