Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1312982 > unrolled thread

[PATCH 0/4] net: mvneta: support more than one clk

Started byJisheng Zhang <jszhang@marvell.com>
First post2016-01-20 09:20 +0100
Last post2016-01-20 09:50 +0100
Articles 12 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/4] net: mvneta: support more than one clk Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 09:20 +0100
    [PATCH 3/4] net: mvneta: mmc: get optional axi clk Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 09:20 +0100
      Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 10:00 +0100
      Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-01-20 10:00 +0100
      Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> - 2016-01-20 10:40 +0100
        Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 10:50 +0100
          Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> - 2016-01-20 12:10 +0100
            Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 12:20 +0100
    [PATCH 4/4] net: mvneta: update clocks property and document additional clock-names Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 09:20 +0100
      Re: [PATCH 4/4] net: mvneta: update clocks property and document  additional clock-names Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-01-20 10:10 +0100
    [PATCH 2/4] net: mvneta: Try to get named core clock first Jisheng Zhang <jszhang@marvell.com> - 2016-01-20 09:20 +0100
      Re: [PATCH 2/4] net: mvneta: Try to get named core clock first Thomas Petazzoni <thomas.petazzoni@free-electrons.com> - 2016-01-20 09:50 +0100

#1312982 — [PATCH 0/4] net: mvneta: support more than one clk

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 09:20 +0100
Subject[PATCH 0/4] net: mvneta: support more than one clk
Message-ID<qSW9I-3JP-7@gated-at.bofh.it>
Some platforms may provide more than one clk for the mvneta IP, for
example Marvell BG4CT provides "core" clk for the mac core, and "axi"
clk for the AXI bus logic.

This series tries to addess the "more than one clk" issue. Note: to
support BG4CT, we have lots of refactor work to do, eg. BG4CT doesn't
have mbus concept etc.

Jisheng Zhang (4):
  net: mvneta: sort the headers in alphabetic order
  net: mvneta: Try to get named core clock first
  net: mvneta: mmc: get optional axi clk
  net: mvneta: update clocks property and document additional
    clock-names

 .../bindings/net/marvell-armada-370-neta.txt       |  6 +++-
 drivers/net/ethernet/marvell/mvneta.c              | 36 ++++++++++++++--------
 2 files changed, 28 insertions(+), 14 deletions(-)

-- 
2.7.0.rc3

[toc] | [next] | [standalone]


#1312983 — [PATCH 3/4] net: mvneta: mmc: get optional axi clk

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 09:20 +0100
Subject[PATCH 3/4] net: mvneta: mmc: get optional axi clk
Message-ID<qSW9I-3JP-13@gated-at.bofh.it>
In reply to#1312982
Some platforms may provide more than one clk for the mvneta IP, for
example Marvell BG4CT provides "core" clk for the mac core, and
"axi" clk for the AXI bus logic. Obviously this "axi" clk also need to
be enabled. This patch adds this optional "axi" clk support.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index aca0a73..6bb709a 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -373,6 +373,8 @@ struct mvneta_port {
 
 	/* Core clock */
 	struct clk *clk;
+	/* AXI clock */
+	struct clk *clk_axi;
 	u8 mcast_count[256];
 	u16 tx_ring_size;
 	u16 rx_ring_size;
@@ -3615,6 +3617,10 @@ static int mvneta_probe(struct platform_device *pdev)
 
 	clk_prepare_enable(pp->clk);
 
+	pp->clk_axi = devm_clk_get(&pdev->dev, "axi");
+	if (!IS_ERR(pp->clk_axi))
+		clk_prepare_enable(pp->clk_axi);
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	pp->base = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(pp->base)) {
@@ -3727,6 +3733,7 @@ err_free_ports:
 	free_percpu(pp->ports);
 err_clk:
 	clk_disable_unprepare(pp->clk);
+	clk_disable_unprepare(pp->clk_axi);
 err_put_phy_node:
 	of_node_put(phy_node);
 err_free_irq:
@@ -3744,6 +3751,7 @@ static int mvneta_remove(struct platform_device *pdev)
 
 	unregister_netdev(dev);
 	clk_disable_unprepare(pp->clk);
+	clk_disable_unprepare(pp->clk_axi);
 	free_percpu(pp->ports);
 	free_percpu(pp->stats);
 	irq_dispose_mapping(dev->irq);
-- 
2.7.0.rc3

[toc] | [prev] | [next] | [standalone]


#1313002 — Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 10:00 +0100
SubjectRe: [PATCH 3/4] net: mvneta: mmc: get optional axi clk
Message-ID<qSWMr-3Yw-11@gated-at.bofh.it>
In reply to#1312983
On Wed, 20 Jan 2016 09:51:32 +0100 Thomas Petazzoni wrote:

> Dear Jisheng Zhang,
> 
> On Wed, 20 Jan 2016 16:06:22 +0800, Jisheng Zhang wrote:
> > Some platforms may provide more than one clk for the mvneta IP, for
> > example Marvell BG4CT provides "core" clk for the mac core, and
> > "axi" clk for the AXI bus logic. Obviously this "axi" clk also need to
> > be enabled. This patch adds this optional "axi" clk support.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>  
> 
> Typo in the title, you have "mmc: ", while this patch is not related to
> MMC, unless I'm missing something and MMC means something else in this
> context.

oops, thanks for pointing out this.

> 
> >  	clk_prepare_enable(pp->clk);
> >  
> > +	pp->clk_axi = devm_clk_get(&pdev->dev, "axi");
> > +	if (!IS_ERR(pp->clk_axi))
> > +		clk_prepare_enable(pp->clk_axi);
> > +
> >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >  	pp->base = devm_ioremap_resource(&pdev->dev, res);
> >  	if (IS_ERR(pp->base)) {
> > @@ -3727,6 +3733,7 @@ err_free_ports:
> >  	free_percpu(pp->ports);
> >  err_clk:
> >  	clk_disable_unprepare(pp->clk);
> > +	clk_disable_unprepare(pp->clk_axi);  
> 
> For the error paths and cleanup steps, I very much prefer when things
> are done in the opposite order of the allocation/creation steps. So can
> you clk_disable_unprepare() the AXI clock before the core clock ?

Both are fine. But I agree with your prefer. Will cook a v2 soon

Thanks for reviewing.

> 
> >  err_put_phy_node:
> >  	of_node_put(phy_node);
> >  err_free_irq:
> > @@ -3744,6 +3751,7 @@ static int mvneta_remove(struct platform_device *pdev)
> >  
> >  	unregister_netdev(dev);
> >  	clk_disable_unprepare(pp->clk);
> > +	clk_disable_unprepare(pp->clk_axi);  
> 
> Ditto.
> 
> Thanks!
> 
> Thomas

[toc] | [prev] | [next] | [standalone]


#1313003 — Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk

FromThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date2016-01-20 10:00 +0100
SubjectRe: [PATCH 3/4] net: mvneta: mmc: get optional axi clk
Message-ID<qSWMr-3Yw-13@gated-at.bofh.it>
In reply to#1312983
Dear Jisheng Zhang,

On Wed, 20 Jan 2016 16:06:22 +0800, Jisheng Zhang wrote:
> Some platforms may provide more than one clk for the mvneta IP, for
> example Marvell BG4CT provides "core" clk for the mac core, and
> "axi" clk for the AXI bus logic. Obviously this "axi" clk also need to
> be enabled. This patch adds this optional "axi" clk support.
> 
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>

Typo in the title, you have "mmc: ", while this patch is not related to
MMC, unless I'm missing something and MMC means something else in this
context.

>  	clk_prepare_enable(pp->clk);
>  
> +	pp->clk_axi = devm_clk_get(&pdev->dev, "axi");
> +	if (!IS_ERR(pp->clk_axi))
> +		clk_prepare_enable(pp->clk_axi);
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	pp->base = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(pp->base)) {
> @@ -3727,6 +3733,7 @@ err_free_ports:
>  	free_percpu(pp->ports);
>  err_clk:
>  	clk_disable_unprepare(pp->clk);
> +	clk_disable_unprepare(pp->clk_axi);

For the error paths and cleanup steps, I very much prefer when things
are done in the opposite order of the allocation/creation steps. So can
you clk_disable_unprepare() the AXI clock before the core clock ?

>  err_put_phy_node:
>  	of_node_put(phy_node);
>  err_free_irq:
> @@ -3744,6 +3751,7 @@ static int mvneta_remove(struct platform_device *pdev)
>  
>  	unregister_netdev(dev);
>  	clk_disable_unprepare(pp->clk);
> +	clk_disable_unprepare(pp->clk_axi);

Ditto.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1313035 — Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk

FromSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Date2016-01-20 10:40 +0100
SubjectRe: [PATCH 3/4] net: mvneta: mmc: get optional axi clk
Message-ID<qSXp7-4uM-3@gated-at.bofh.it>
In reply to#1312983
On January 20, 2016 9:15:22 AM Jisheng Zhang <jszhang@marvell.com> wrote:

> Some platforms may provide more than one clk for the mvneta IP, for
> example Marvell BG4CT provides "core" clk for the mac core, and
> "axi" clk for the AXI bus logic. Obviously this "axi" clk also need to
> be enabled. This patch adds this optional "axi" clk support.

Jisheng,

although I do not expect mvneta to appear on a non-AXI bus
anytime soon, how about naming the clock "bus" instead?

If you know the clock is only required for bus master DMA but
not for register access, "dma" would be an even better name.

Sebastian


> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/mvneta.c 
> b/drivers/net/ethernet/marvell/mvneta.c
> index aca0a73..6bb709a 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -373,6 +373,8 @@ struct mvneta_port {
>
>  	/* Core clock */
>  	struct clk *clk;
> +	/* AXI clock */
> +	struct clk *clk_axi;
>  	u8 mcast_count[256];
>  	u16 tx_ring_size;
>  	u16 rx_ring_size;
> @@ -3615,6 +3617,10 @@ static int mvneta_probe(struct platform_device *pdev)
>
>  	clk_prepare_enable(pp->clk);
>
> +	pp->clk_axi = devm_clk_get(&pdev->dev, "axi");
> +	if (!IS_ERR(pp->clk_axi))
> +		clk_prepare_enable(pp->clk_axi);
> +
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	pp->base = devm_ioremap_resource(&pdev->dev, res);
>  	if (IS_ERR(pp->base)) {
> @@ -3727,6 +3733,7 @@ err_free_ports:
>  	free_percpu(pp->ports);
>  err_clk:
>  	clk_disable_unprepare(pp->clk);
> +	clk_disable_unprepare(pp->clk_axi);
>  err_put_phy_node:
>  	of_node_put(phy_node);
>  err_free_irq:
> @@ -3744,6 +3751,7 @@ static int mvneta_remove(struct platform_device *pdev)
>
>  	unregister_netdev(dev);
>  	clk_disable_unprepare(pp->clk);
> +	clk_disable_unprepare(pp->clk_axi);
>  	free_percpu(pp->ports);
>  	free_percpu(pp->stats);
>  	irq_dispose_mapping(dev->irq);
> --
> 2.7.0.rc3
>

[toc] | [prev] | [next] | [standalone]


#1313041 — Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 10:50 +0100
SubjectRe: [PATCH 3/4] net: mvneta: mmc: get optional axi clk
Message-ID<qSXyO-4y5-5@gated-at.bofh.it>
In reply to#1313035
On Wed, 20 Jan 2016 10:31:18 +0100 Sebastian Hesselbarth  wrote:

> On January 20, 2016 9:15:22 AM Jisheng Zhang wrote:
> 
> > Some platforms may provide more than one clk for the mvneta IP, for
> > example Marvell BG4CT provides "core" clk for the mac core, and
> > "axi" clk for the AXI bus logic. Obviously this "axi" clk also need to
> > be enabled. This patch adds this optional "axi" clk support.  
> 
> Jisheng,
> 
> although I do not expect mvneta to appear on a non-AXI bus
> anytime soon, how about naming the clock "bus" instead?

Good question. IIRC, this IP expects AXI bus, but I'll check with HW people.

Thanks a lot,
Jisheng

> 
> If you know the clock is only required for bus master DMA but
> not for register access, "dma" would be an even better name.
> 
> Sebastian
> 
> 
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > ---
> >  drivers/net/ethernet/marvell/mvneta.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/marvell/mvneta.c 
> > b/drivers/net/ethernet/marvell/mvneta.c
> > index aca0a73..6bb709a 100644
> > --- a/drivers/net/ethernet/marvell/mvneta.c
> > +++ b/drivers/net/ethernet/marvell/mvneta.c
> > @@ -373,6 +373,8 @@ struct mvneta_port {
> >
> >  	/* Core clock */
> >  	struct clk *clk;
> > +	/* AXI clock */
> > +	struct clk *clk_axi;
> >  	u8 mcast_count[256];
> >  	u16 tx_ring_size;
> >  	u16 rx_ring_size;
> > @@ -3615,6 +3617,10 @@ static int mvneta_probe(struct platform_device *pdev)
> >
> >  	clk_prepare_enable(pp->clk);
> >
> > +	pp->clk_axi = devm_clk_get(&pdev->dev, "axi");
> > +	if (!IS_ERR(pp->clk_axi))
> > +		clk_prepare_enable(pp->clk_axi);
> > +
> >  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >  	pp->base = devm_ioremap_resource(&pdev->dev, res);
> >  	if (IS_ERR(pp->base)) {
> > @@ -3727,6 +3733,7 @@ err_free_ports:
> >  	free_percpu(pp->ports);
> >  err_clk:
> >  	clk_disable_unprepare(pp->clk);
> > +	clk_disable_unprepare(pp->clk_axi);
> >  err_put_phy_node:
> >  	of_node_put(phy_node);
> >  err_free_irq:
> > @@ -3744,6 +3751,7 @@ static int mvneta_remove(struct platform_device *pdev)
> >
> >  	unregister_netdev(dev);
> >  	clk_disable_unprepare(pp->clk);
> > +	clk_disable_unprepare(pp->clk_axi);
> >  	free_percpu(pp->ports);
> >  	free_percpu(pp->stats);
> >  	irq_dispose_mapping(dev->irq);
> > --
> > 2.7.0.rc3
> >  
> 
> 

[toc] | [prev] | [next] | [standalone]


#1313122 — Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk

FromSebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Date2016-01-20 12:10 +0100
SubjectRe: [PATCH 3/4] net: mvneta: mmc: get optional axi clk
Message-ID<qSYOe-5wS-11@gated-at.bofh.it>
In reply to#1313041
On 01/20/2016 10:42 AM, Jisheng Zhang wrote:
> On Wed, 20 Jan 2016 10:31:18 +0100 Sebastian Hesselbarth  wrote:
>
>> On January 20, 2016 9:15:22 AM Jisheng Zhang wrote:
>>
>>> Some platforms may provide more than one clk for the mvneta IP, for
>>> example Marvell BG4CT provides "core" clk for the mac core, and
>>> "axi" clk for the AXI bus logic. Obviously this "axi" clk also need to
>>> be enabled. This patch adds this optional "axi" clk support.
>>
>> Jisheng,
>>
>> although I do not expect mvneta to appear on a non-AXI bus
>> anytime soon, how about naming the clock "bus" instead?
>
> Good question. IIRC, this IP expects AXI bus, but I'll check with HW people.

Actually, I am quite sure the current IP requires AXI. But my comment
was more about to make the binding a little bit more flexible to
_future_ variants/SoCs we may stumble upon.

Naming the clock "bus" or "dma" will work for the current _and_ future
IPs, while "axi" may not.

Sebastian

>>
>> If you know the clock is only required for bus master DMA but
>> not for register access, "dma" would be an even better name.
>>
>> Sebastian
>>
>>
>>> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
>>> ---
>>>   drivers/net/ethernet/marvell/mvneta.c | 8 ++++++++
>>>   1 file changed, 8 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/marvell/mvneta.c
>>> b/drivers/net/ethernet/marvell/mvneta.c
>>> index aca0a73..6bb709a 100644
>>> --- a/drivers/net/ethernet/marvell/mvneta.c
>>> +++ b/drivers/net/ethernet/marvell/mvneta.c
>>> @@ -373,6 +373,8 @@ struct mvneta_port {
>>>
>>>   	/* Core clock */
>>>   	struct clk *clk;
>>> +	/* AXI clock */
>>> +	struct clk *clk_axi;
>>>   	u8 mcast_count[256];
>>>   	u16 tx_ring_size;
>>>   	u16 rx_ring_size;
>>> @@ -3615,6 +3617,10 @@ static int mvneta_probe(struct platform_device *pdev)
>>>
>>>   	clk_prepare_enable(pp->clk);
>>>
>>> +	pp->clk_axi = devm_clk_get(&pdev->dev, "axi");
>>> +	if (!IS_ERR(pp->clk_axi))
>>> +		clk_prepare_enable(pp->clk_axi);
>>> +
>>>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>>   	pp->base = devm_ioremap_resource(&pdev->dev, res);
>>>   	if (IS_ERR(pp->base)) {
>>> @@ -3727,6 +3733,7 @@ err_free_ports:
>>>   	free_percpu(pp->ports);
>>>   err_clk:
>>>   	clk_disable_unprepare(pp->clk);
>>> +	clk_disable_unprepare(pp->clk_axi);
>>>   err_put_phy_node:
>>>   	of_node_put(phy_node);
>>>   err_free_irq:
>>> @@ -3744,6 +3751,7 @@ static int mvneta_remove(struct platform_device *pdev)
>>>
>>>   	unregister_netdev(dev);
>>>   	clk_disable_unprepare(pp->clk);
>>> +	clk_disable_unprepare(pp->clk_axi);
>>>   	free_percpu(pp->ports);
>>>   	free_percpu(pp->stats);
>>>   	irq_dispose_mapping(dev->irq);
>>> --
>>> 2.7.0.rc3
>>>
>>
>>
>

[toc] | [prev] | [next] | [standalone]


#1313135 — Re: [PATCH 3/4] net: mvneta: mmc: get optional axi clk

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 12:20 +0100
SubjectRe: [PATCH 3/4] net: mvneta: mmc: get optional axi clk
Message-ID<qSYXU-5Aj-21@gated-at.bofh.it>
In reply to#1313122
Dear Sebastian,

On Wed, 20 Jan 2016 12:03:03 +0100 Sebastian Hesselbarth wrote:

> On 01/20/2016 10:42 AM, Jisheng Zhang wrote:
> > On Wed, 20 Jan 2016 10:31:18 +0100 Sebastian Hesselbarth  wrote:
> >  
> >> On January 20, 2016 9:15:22 AM Jisheng Zhang wrote:
> >>  
> >>> Some platforms may provide more than one clk for the mvneta IP, for
> >>> example Marvell BG4CT provides "core" clk for the mac core, and
> >>> "axi" clk for the AXI bus logic. Obviously this "axi" clk also need to
> >>> be enabled. This patch adds this optional "axi" clk support.  
> >>
> >> Jisheng,
> >>
> >> although I do not expect mvneta to appear on a non-AXI bus
> >> anytime soon, how about naming the clock "bus" instead?  
> >
> > Good question. IIRC, this IP expects AXI bus, but I'll check with HW people.  
> 
> Actually, I am quite sure the current IP requires AXI. But my comment
> was more about to make the binding a little bit more flexible to
> _future_ variants/SoCs we may stumble upon.

Got your points. PS: the clk is for AXI bus logic, so "bus" makes sense.

> 
> Naming the clock "bus" or "dma" will work for the current _and_ future
> IPs, while "axi" may not.

Indeed, will cook a v3

Thanks a lot for review,
Jisheng

> 
> Sebastian
> 
> >>
> >> If you know the clock is only required for bus master DMA but
> >> not for register access, "dma" would be an even better name.
> >>
> >> Sebastian
> >>
> >>  
> >>> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> >>> ---
> >>>   drivers/net/ethernet/marvell/mvneta.c | 8 ++++++++
> >>>   1 file changed, 8 insertions(+)
> >>>
> >>> diff --git a/drivers/net/ethernet/marvell/mvneta.c
> >>> b/drivers/net/ethernet/marvell/mvneta.c
> >>> index aca0a73..6bb709a 100644
> >>> --- a/drivers/net/ethernet/marvell/mvneta.c
> >>> +++ b/drivers/net/ethernet/marvell/mvneta.c
> >>> @@ -373,6 +373,8 @@ struct mvneta_port {
> >>>
> >>>   	/* Core clock */
> >>>   	struct clk *clk;
> >>> +	/* AXI clock */
> >>> +	struct clk *clk_axi;
> >>>   	u8 mcast_count[256];
> >>>   	u16 tx_ring_size;
> >>>   	u16 rx_ring_size;
> >>> @@ -3615,6 +3617,10 @@ static int mvneta_probe(struct platform_device *pdev)
> >>>
> >>>   	clk_prepare_enable(pp->clk);
> >>>
> >>> +	pp->clk_axi = devm_clk_get(&pdev->dev, "axi");
> >>> +	if (!IS_ERR(pp->clk_axi))
> >>> +		clk_prepare_enable(pp->clk_axi);
> >>> +
> >>>   	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> >>>   	pp->base = devm_ioremap_resource(&pdev->dev, res);
> >>>   	if (IS_ERR(pp->base)) {
> >>> @@ -3727,6 +3733,7 @@ err_free_ports:
> >>>   	free_percpu(pp->ports);
> >>>   err_clk:
> >>>   	clk_disable_unprepare(pp->clk);
> >>> +	clk_disable_unprepare(pp->clk_axi);
> >>>   err_put_phy_node:
> >>>   	of_node_put(phy_node);
> >>>   err_free_irq:
> >>> @@ -3744,6 +3751,7 @@ static int mvneta_remove(struct platform_device *pdev)
> >>>
> >>>   	unregister_netdev(dev);
> >>>   	clk_disable_unprepare(pp->clk);
> >>> +	clk_disable_unprepare(pp->clk_axi);
> >>>   	free_percpu(pp->ports);
> >>>   	free_percpu(pp->stats);
> >>>   	irq_dispose_mapping(dev->irq);
> >>> --
> >>> 2.7.0.rc3
> >>>  
> >>
> >>  
> >  

[toc] | [prev] | [next] | [standalone]


#1312984 — [PATCH 4/4] net: mvneta: update clocks property and document additional clock-names

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 09:20 +0100
Subject[PATCH 4/4] net: mvneta: update clocks property and document additional clock-names
Message-ID<qSW9I-3JP-15@gated-at.bofh.it>
In reply to#1312982
Now that mvneta driver allows to have more than one clock defined,
update the clocks property and document the clock-names property.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
index aeea50c..f85b93b 100644
--- a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
+++ b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
@@ -6,12 +6,16 @@ Required properties:
 - interrupts: interrupt for the device
 - phy: See ethernet.txt file in the same directory.
 - phy-mode: See ethernet.txt file in the same directory
-- clocks: a pointer to the reference clock for this device.
+- clocks: Array of clocks required for this device; requires at least one
+  for CORE clock.
 
 Optional properties:
 - tx-csum-limit: maximum mtu supported by port that allow TX checksum.
   Value is presented in bytes. If not used, by default 1600B is set for
   "marvell,armada-370-neta" and 9800B for others.
+- clock-names: Array of names corresponding to clocks property; shall be
+  "core" for CORE clock and "axi" for optional AXI clock.
+
 
 Example:
 
-- 
2.7.0.rc3

[toc] | [prev] | [next] | [standalone]


#1313013 — Re: [PATCH 4/4] net: mvneta: update clocks property and document additional clock-names

FromThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date2016-01-20 10:10 +0100
SubjectRe: [PATCH 4/4] net: mvneta: update clocks property and document additional clock-names
Message-ID<qSWW7-4hT-31@gated-at.bofh.it>
In reply to#1312984
Dear Jisheng Zhang,

On Wed, 20 Jan 2016 16:06:23 +0800, Jisheng Zhang wrote:

> diff --git a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
> index aeea50c..f85b93b 100644
> --- a/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
> +++ b/Documentation/devicetree/bindings/net/marvell-armada-370-neta.txt
> @@ -6,12 +6,16 @@ Required properties:
>  - interrupts: interrupt for the device
>  - phy: See ethernet.txt file in the same directory.
>  - phy-mode: See ethernet.txt file in the same directory
> -- clocks: a pointer to the reference clock for this device.
> +- clocks: Array of clocks required for this device; requires at least one
> +  for CORE clock.

Rather than "Array", I would say "list", so what about:

 - clocks: List of clocks for this device. At least one clock is
   mandatory for the core clock. If several clocks are given, then the
   clock-names property must be used to identify them.

>  Optional properties:
>  - tx-csum-limit: maximum mtu supported by port that allow TX checksum.
>    Value is presented in bytes. If not used, by default 1600B is set for
>    "marvell,armada-370-neta" and 9800B for others.
> +- clock-names: Array of names corresponding to clocks property; shall be
> +  "core" for CORE clock and "axi" for optional AXI clock.

Array -> List.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1312985 — [PATCH 2/4] net: mvneta: Try to get named core clock first

FromJisheng Zhang <jszhang@marvell.com>
Date2016-01-20 09:20 +0100
Subject[PATCH 2/4] net: mvneta: Try to get named core clock first
Message-ID<qSW9J-3JP-21@gated-at.bofh.it>
In reply to#1312982
Some platforms may provide more than one clk for the mvneta IP, for
example Marvell BG4CT provides "core" clk for the mac core, and "axi"
clk for the AXI bus logic.

To support for more than one clock, we'll need to distinguish between
the clock by name. Change clock probing to first try to get "core"
clock before falling back to unnamed clock.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/net/ethernet/marvell/mvneta.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 79e0c7d..aca0a73 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3605,7 +3605,9 @@ static int mvneta_probe(struct platform_device *pdev)
 
 	pp->indir[0] = rxq_def;
 
-	pp->clk = devm_clk_get(&pdev->dev, NULL);
+	pp->clk = devm_clk_get(&pdev->dev, "core");
+	if (IS_ERR(pp->clk))
+		pp->clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(pp->clk)) {
 		err = PTR_ERR(pp->clk);
 		goto err_put_phy_node;
-- 
2.7.0.rc3

[toc] | [prev] | [next] | [standalone]


#1312996 — Re: [PATCH 2/4] net: mvneta: Try to get named core clock first

FromThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date2016-01-20 09:50 +0100
SubjectRe: [PATCH 2/4] net: mvneta: Try to get named core clock first
Message-ID<qSWCJ-3V7-5@gated-at.bofh.it>
In reply to#1312985
Dear Jisheng Zhang,

On Wed, 20 Jan 2016 16:06:21 +0800, Jisheng Zhang wrote:
> Some platforms may provide more than one clk for the mvneta IP, for
> example Marvell BG4CT provides "core" clk for the mac core, and "axi"
> clk for the AXI bus logic.
> 
> To support for more than one clock, we'll need to distinguish between
> the clock by name. Change clock probing to first try to get "core"
> clock before falling back to unnamed clock.
> 
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
>  drivers/net/ethernet/marvell/mvneta.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web