2013-10-18 11:54:29

by Sebastian Hesselbarth

[permalink] [raw]
Subject: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

With legacy devices converted to DT and a proper ethernet MAC
workaround, we can now remove the clk workarounds for legacy
devices. While at it, also cleanup the list of includes.

Signed-off-by: Sebastian Hesselbarth <[email protected]>
---
As a follow-up patch for latest mvebu PRs, this patch is based on
git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2

Cc: Jason Cooper <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Russell King <[email protected]>
Cc: Kevin Hilman <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
arch/arm/mach-kirkwood/board-dt.c | 42 ++----------------------------------
1 files changed, 3 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 27c1877..3f5984e 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -10,56 +10,22 @@
* warranty of any kind, whether express or implied.
*/

+#include <linux/clk.h>
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_net.h>
#include <linux/of_platform.h>
#include <linux/clk-provider.h>
#include <linux/clocksource.h>
-#include <linux/dma-mapping.h>
-#include <linux/irqchip.h>
-#include <linux/kexec.h>
+#include <linux/slab.h>
#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
#include <mach/bridge-regs.h>
-#include <linux/platform_data/usb-ehci-orion.h>
-#include <plat/irq.h>
#include <plat/common.h>
#include "common.h"

-/*
- * There are still devices that doesn't know about DT yet. Get clock
- * gates here and add a clock lookup alias, so that old platform
- * devices still work.
-*/
-
-static void __init kirkwood_legacy_clk_init(void)
-{
-
- struct device_node *np = of_find_compatible_node(
- NULL, NULL, "marvell,kirkwood-gating-clock");
- struct of_phandle_args clkspec;
- struct clk *clk;
-
- clkspec.np = np;
- clkspec.args_count = 1;
-
- /*
- * The ethernet interfaces forget the MAC address assigned by
- * u-boot if the clocks are turned off. Until proper DT support
- * is available we always enable them for now.
- */
- clkspec.args[0] = CGC_BIT_GE0;
- clk = of_clk_get_from_provider(&clkspec);
- clk_prepare_enable(clk);
-
- clkspec.args[0] = CGC_BIT_GE1;
- clk = of_clk_get_from_provider(&clkspec);
- clk_prepare_enable(clk);
-}
-
#define MV643XX_ETH_MAC_ADDR_LOW 0x0414
#define MV643XX_ETH_MAC_ADDR_HIGH 0x0418

@@ -164,8 +130,6 @@ static void __init kirkwood_dt_init(void)

kirkwood_cpufreq_init();
kirkwood_cpuidle_init();
- /* Setup clocks for legacy devices */
- kirkwood_legacy_clk_init();

kirkwood_pm_init();
kirkwood_dt_eth_fixup();
--
1.7.2.5


2013-10-18 14:48:18

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

On Fri, Oct 18, 2013 at 01:54:13PM +0200, Sebastian Hesselbarth wrote:
> With legacy devices converted to DT and a proper ethernet MAC
> workaround, we can now remove the clk workarounds for legacy
> devices. While at it, also cleanup the list of includes.
>
> Signed-off-by: Sebastian Hesselbarth <[email protected]>
> ---
> As a follow-up patch for latest mvebu PRs, this patch is based on
> git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2
>
> Cc: Jason Cooper <[email protected]>
> Cc: Andrew Lunn <[email protected]>
> Cc: Russell King <[email protected]>
> Cc: Kevin Hilman <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> ---
> arch/arm/mach-kirkwood/board-dt.c | 42 ++----------------------------------
> 1 files changed, 3 insertions(+), 39 deletions(-)

Applied to mvebu/soc

thx,

Jason.

2013-10-18 16:17:32

by Ezequiel Garcia

[permalink] [raw]
Subject: Re: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

On Fri, Oct 18, 2013 at 10:47:41AM -0400, Jason Cooper wrote:
> On Fri, Oct 18, 2013 at 01:54:13PM +0200, Sebastian Hesselbarth wrote:
> > With legacy devices converted to DT and a proper ethernet MAC
> > workaround, we can now remove the clk workarounds for legacy
> > devices. While at it, also cleanup the list of includes.
> >
> > Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > ---
> > As a follow-up patch for latest mvebu PRs, this patch is based on
> > git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2
> >
> > Cc: Jason Cooper <[email protected]>
> > Cc: Andrew Lunn <[email protected]>
> > Cc: Russell King <[email protected]>
> > Cc: Kevin Hilman <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > ---
> > arch/arm/mach-kirkwood/board-dt.c | 42 ++----------------------------------
> > 1 files changed, 3 insertions(+), 39 deletions(-)
>
> Applied to mvebu/soc
>

Weird: I've tried to do this clean-up myself and my usual tests with network
built as a module failed somehow. Maybe I missed something and did something
stupid?

Of course, I'll re-try and let you all know...
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com

2013-10-18 16:20:37

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

On Fri, Oct 18, 2013 at 01:17:44PM -0300, Ezequiel Garcia wrote:
> On Fri, Oct 18, 2013 at 10:47:41AM -0400, Jason Cooper wrote:
> > On Fri, Oct 18, 2013 at 01:54:13PM +0200, Sebastian Hesselbarth wrote:
> > > With legacy devices converted to DT and a proper ethernet MAC
> > > workaround, we can now remove the clk workarounds for legacy
> > > devices. While at it, also cleanup the list of includes.
> > >
> > > Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > > ---
> > > As a follow-up patch for latest mvebu PRs, this patch is based on
> > > git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2
> > >
> > > Cc: Jason Cooper <[email protected]>
> > > Cc: Andrew Lunn <[email protected]>
> > > Cc: Russell King <[email protected]>
> > > Cc: Kevin Hilman <[email protected]>
> > > Cc: [email protected]
> > > Cc: [email protected]
> > > ---
> > > arch/arm/mach-kirkwood/board-dt.c | 42 ++----------------------------------
> > > 1 files changed, 3 insertions(+), 39 deletions(-)
> >
> > Applied to mvebu/soc
> >
>
> Weird: I've tried to do this clean-up myself and my usual tests with network
> built as a module failed somehow. Maybe I missed something and did something
> stupid?
>
> Of course, I'll re-try and let you all know...

Please do. You can try mvebu/for-next now. It has this and everything
else we need to test for the merge window.

thx,

Jason.

2013-10-18 17:27:40

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

On 10/18/2013 06:17 PM, Ezequiel Garcia wrote:
> On Fri, Oct 18, 2013 at 10:47:41AM -0400, Jason Cooper wrote:
>> On Fri, Oct 18, 2013 at 01:54:13PM +0200, Sebastian Hesselbarth wrote:
>>> With legacy devices converted to DT and a proper ethernet MAC
>>> workaround, we can now remove the clk workarounds for legacy
>>> devices. While at it, also cleanup the list of includes.
>>>
>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>> ---
>>> As a follow-up patch for latest mvebu PRs, this patch is based on
>>> git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2
>>>
>>> Cc: Jason Cooper <[email protected]>
>>> Cc: Andrew Lunn <[email protected]>
>>> Cc: Russell King <[email protected]>
>>> Cc: Kevin Hilman <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> ---
>>> arch/arm/mach-kirkwood/board-dt.c | 42 ++----------------------------------
>>> 1 files changed, 3 insertions(+), 39 deletions(-)
>>
>> Applied to mvebu/soc
>>
>
> Weird: I've tried to do this clean-up myself and my usual tests with network
> built as a module failed somehow. Maybe I missed something and did something
> stupid?

Ezequiel,

you need commits
b5d82db net: mv643xx_eth: fix missing device_node for port devices
f564412 net: mv643xx_eth: fix orphaned statistics timer crash
041b4dd net: mv643xx_eth: update statistics timer from timer context only

from git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master

Those are the three net driver fixes and have not yet been pulled into
mainline linux.

Can you re-test with those three applied (or you can just merge in
above master)? I am compiling right now and will report.

Sebastian

2013-10-18 17:44:07

by Sebastian Hesselbarth

[permalink] [raw]
Subject: Re: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

On 10/18/2013 07:27 PM, Sebastian Hesselbarth wrote:
> On 10/18/2013 06:17 PM, Ezequiel Garcia wrote:
>> On Fri, Oct 18, 2013 at 10:47:41AM -0400, Jason Cooper wrote:
>>> On Fri, Oct 18, 2013 at 01:54:13PM +0200, Sebastian Hesselbarth wrote:
>>>> With legacy devices converted to DT and a proper ethernet MAC
>>>> workaround, we can now remove the clk workarounds for legacy
>>>> devices. While at it, also cleanup the list of includes.
>>>>
>>>> Signed-off-by: Sebastian Hesselbarth <[email protected]>
>>>> ---
>>>> As a follow-up patch for latest mvebu PRs, this patch is based on
>>>> git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2
>>>>
>>>> Cc: Jason Cooper <[email protected]>
>>>> Cc: Andrew Lunn <[email protected]>
>>>> Cc: Russell King <[email protected]>
>>>> Cc: Kevin Hilman <[email protected]>
>>>> Cc: [email protected]
>>>> Cc: [email protected]
>>>> ---
>>>> arch/arm/mach-kirkwood/board-dt.c | 42
>>>> ++----------------------------------
>>>> 1 files changed, 3 insertions(+), 39 deletions(-)
>>>
>>> Applied to mvebu/soc
>>>
>>
>> Weird: I've tried to do this clean-up myself and my usual tests with
>> network
>> built as a module failed somehow. Maybe I missed something and did
>> something
>> stupid?
>
> Ezequiel,
>
> you need commits
> b5d82db net: mv643xx_eth: fix missing device_node for port devices
> f564412 net: mv643xx_eth: fix orphaned statistics timer crash
> 041b4dd net: mv643xx_eth: update statistics timer from timer context only
>
> from git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
>
> Those are the three net driver fixes and have not yet been pulled into
> mainline linux.
>
> Can you re-test with those three applied (or you can just merge in
> above master)? I am compiling right now and will report.

With mvebu/for-next and net/master merged in,
modular mvmdio and mv643xx_eth on Kirkwood Dockstar:

Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail>

IOW, works. I hope you can confirm this, too.

Sebastian

Log follows:
---
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 3.12.0-rc3-00388-g863cf23 (hesselba@nijin)
(gcc version 4.3.5 (Debian 4.3.5-4) ) #26 PREEMPT Fri Oct 18 19:30:40
CEST 2013
[ 0.000000] CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE),
cr=00053977
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] Machine: Marvell Kirkwood (Flattened Device Tree), model:
Seagate FreeAgent Dockstar
...
[ 0.165779] [Firmware Info]:
/ocp@f1000000/ethernet-controller@72000/ethernet0-port@0:
local-mac-address is not set
...
root@cosmo:~# insmod mvmdio.ko
[ 206.994283] libphy: orion_mdio_bus: probed
root@cosmo:~# insmod mv643xx_eth.ko
[ 210.725345] mv643xx_eth: MV-643xx 10/100/1000 ethernet driver version 1.4
[ 211.748687] mv643xx_eth_port mv643xx_eth_port.0 eth0: port 0 with MAC
address 02:50:43:19:fd:e2
[ 214.599588] mv643xx_eth_port mv643xx_eth_port.0 eth0: link up, 1000
Mb/s, full duplex, flow control disabled
...
root@cosmo:~# dhclient eth0
...
RTNETLINK answers: File exists

root@cosmo:~# ifconfig

eth0 Link encap:Ethernet HWaddr 02:50:43:19:fd:e2

inet addr:192.168.1.54 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2822 (2.7 KiB) TX bytes:4049 (3.9 KiB)
Interrupt:29

2013-10-18 17:46:01

by Jason Cooper

[permalink] [raw]
Subject: Re: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

On Fri, Oct 18, 2013 at 07:43:54PM +0200, Sebastian Hesselbarth wrote:
> On 10/18/2013 07:27 PM, Sebastian Hesselbarth wrote:
> >On 10/18/2013 06:17 PM, Ezequiel Garcia wrote:
> >>On Fri, Oct 18, 2013 at 10:47:41AM -0400, Jason Cooper wrote:
> >>>On Fri, Oct 18, 2013 at 01:54:13PM +0200, Sebastian Hesselbarth wrote:
> >>>>With legacy devices converted to DT and a proper ethernet MAC
> >>>>workaround, we can now remove the clk workarounds for legacy
> >>>>devices. While at it, also cleanup the list of includes.
> >>>>
> >>>>Signed-off-by: Sebastian Hesselbarth <[email protected]>
> >>>>---
> >>>>As a follow-up patch for latest mvebu PRs, this patch is based on
> >>>> git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2
> >>>>
> >>>>Cc: Jason Cooper <[email protected]>
> >>>>Cc: Andrew Lunn <[email protected]>
> >>>>Cc: Russell King <[email protected]>
> >>>>Cc: Kevin Hilman <[email protected]>
> >>>>Cc: [email protected]
> >>>>Cc: [email protected]
> >>>>---
> >>>> arch/arm/mach-kirkwood/board-dt.c | 42
> >>>>++----------------------------------
> >>>> 1 files changed, 3 insertions(+), 39 deletions(-)
> >>>
> >>>Applied to mvebu/soc
> >>>
> >>
> >>Weird: I've tried to do this clean-up myself and my usual tests with
> >>network
> >>built as a module failed somehow. Maybe I missed something and did
> >>something
> >>stupid?
> >
> >Ezequiel,
> >
> >you need commits
> >b5d82db net: mv643xx_eth: fix missing device_node for port devices
> >f564412 net: mv643xx_eth: fix orphaned statistics timer crash
> >041b4dd net: mv643xx_eth: update statistics timer from timer context only
> >
> >from git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
> >
> >Those are the three net driver fixes and have not yet been pulled into
> >mainline linux.
> >
> >Can you re-test with those three applied (or you can just merge in
> >above master)? I am compiling right now and will report.
>
> With mvebu/for-next and net/master merged in,
> modular mvmdio and mv643xx_eth on Kirkwood Dockstar:
>
> Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail>
>
> IOW, works. I hope you can confirm this, too.

Nice! Thanks for testing.

thx,

Jason.

2013-10-31 23:54:45

by Ezequiel Garcia

[permalink] [raw]
Subject: Re: [PATCH] ARM: kirkwood: remove lagacy clk workarounds

On Fri, Oct 18, 2013 at 01:45:45PM -0400, Jason Cooper wrote:
> On Fri, Oct 18, 2013 at 07:43:54PM +0200, Sebastian Hesselbarth wrote:
> > On 10/18/2013 07:27 PM, Sebastian Hesselbarth wrote:
> > >On 10/18/2013 06:17 PM, Ezequiel Garcia wrote:
> > >>On Fri, Oct 18, 2013 at 10:47:41AM -0400, Jason Cooper wrote:
> > >>>On Fri, Oct 18, 2013 at 01:54:13PM +0200, Sebastian Hesselbarth wrote:
> > >>>>With legacy devices converted to DT and a proper ethernet MAC
> > >>>>workaround, we can now remove the clk workarounds for legacy
> > >>>>devices. While at it, also cleanup the list of includes.
> > >>>>
> > >>>>Signed-off-by: Sebastian Hesselbarth <[email protected]>
> > >>>>---
> > >>>>As a follow-up patch for latest mvebu PRs, this patch is based on
> > >>>> git://git.infradead.org/linux-mvebu.git tags/soc-3.13-2
> > >>>>
> > >>>>Cc: Jason Cooper <[email protected]>
> > >>>>Cc: Andrew Lunn <[email protected]>
> > >>>>Cc: Russell King <[email protected]>
> > >>>>Cc: Kevin Hilman <[email protected]>
> > >>>>Cc: [email protected]
> > >>>>Cc: [email protected]
> > >>>>---
> > >>>> arch/arm/mach-kirkwood/board-dt.c | 42
> > >>>>++----------------------------------
> > >>>> 1 files changed, 3 insertions(+), 39 deletions(-)
> > >>>
> > >>>Applied to mvebu/soc
> > >>>
> > >>
> > >>Weird: I've tried to do this clean-up myself and my usual tests with
> > >>network
> > >>built as a module failed somehow. Maybe I missed something and did
> > >>something
> > >>stupid?
> > >
> > >Ezequiel,
> > >
> > >you need commits
> > >b5d82db net: mv643xx_eth: fix missing device_node for port devices
> > >f564412 net: mv643xx_eth: fix orphaned statistics timer crash
> > >041b4dd net: mv643xx_eth: update statistics timer from timer context only
> > >
> > >from git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master
> > >
> > >Those are the three net driver fixes and have not yet been pulled into
> > >mainline linux.
> > >
> > >Can you re-test with those three applied (or you can just merge in
> > >above master)? I am compiling right now and will report.
> >
> > With mvebu/for-next and net/master merged in,
> > modular mvmdio and mv643xx_eth on Kirkwood Dockstar:
> >
> > Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail>
> >
> > IOW, works. I hope you can confirm this, too.

Hm... Sorry for the huge delay, I've only had time just now to test this:

Tested-by: Ezequiel Garcia <[email protected]>

Although I realise it's too late for v3.13.

Nice work Sebastian!
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com