diff mbox

ep93xx-eth: convert to phylib

Message ID 201106051957.36492.florian@openwrt.org (mailing list archive)
State New, archived
Headers show

Commit Message

Florian Fainelli June 5, 2011, 5:57 p.m. UTC
ep93xx-eth lacked support for monitoring link status changes, with this
patch, link changes are now watched and reported correctly.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---

Comments

Florian Fainelli June 5, 2011, 6:29 p.m. UTC | #1
On Sunday 05 June 2011 19:57:36 Florian Fainelli wrote:
> ep93xx-eth lacked support for monitoring link status changes, with this
> patch, link changes are now watched and reported correctly.
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> ---

I just stumbled upon: http://www.mail-
archive.com/netdev@vger.kernel.org/msg62549.html
which does not seem to have been merged.

I will respin my patch with Herbert's changes
--
Florian
David Miller June 5, 2011, 9:06 p.m. UTC | #2
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Sun, 5 Jun 2011 20:29:24 +0200

> On Sunday 05 June 2011 19:57:36 Florian Fainelli wrote:
>> ep93xx-eth lacked support for monitoring link status changes, with this
>> patch, link changes are now watched and reported correctly.
>> 
>> Signed-off-by: Florian Fainelli <florian@openwrt.org>
>> ---
> 
> I just stumbled upon: http://www.mail-
> archive.com/netdev@vger.kernel.org/msg62549.html
> which does not seem to have been merged.
> 
> I will respin my patch with Herbert's changes

If people wonder why things don't get merged in situations like
this it's because there is no clear person standing up to act as
a maintainer.

Instead there are several different people submitting changes to
this one driver and I haven't got a clue who is authoritative and
who is not.

So 9 times out of ten I'm not going to merge anything submitted
in this way unless I start to see lots of ACKs from other developers.

When it gets to the point where multiple people are touching the
driver in all sorts of ways, there needs to be someone to do all of
the merging and making sure the patches get applied in the right order
and handling merge conflicts handled properly.  Then they submit them
formally here as a sane single set of patches to the list.

So who is going to step up and be the ep93xx-eth maintainer?  Lennert
is listed in MAINTAINERS, but I see little to no activity from him.

The last ACK Lennert gave for a patch to this driver was in May 2010,
more than a year ago.
Florian Fainelli June 6, 2011, 5:15 a.m. UTC | #3
On Sunday 05 June 2011 23:06:57 David Miller wrote:
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Sun, 5 Jun 2011 20:29:24 +0200
> 
> > On Sunday 05 June 2011 19:57:36 Florian Fainelli wrote:
> >> ep93xx-eth lacked support for monitoring link status changes, with this
> >> patch, link changes are now watched and reported correctly.
> >> 
> >> Signed-off-by: Florian Fainelli <florian@openwrt.org>
> >> ---
> > 
> > I just stumbled upon: http://www.mail-
> > archive.com/netdev@vger.kernel.org/msg62549.html
> > which does not seem to have been merged.
> > 
> > I will respin my patch with Herbert's changes
> 
> If people wonder why things don't get merged in situations like
> this it's because there is no clear person standing up to act as
> a maintainer.

No problem here so far.

> 
> Instead there are several different people submitting changes to
> this one driver and I haven't got a clue who is authoritative and
> who is not.
> 
> So 9 times out of ten I'm not going to merge anything submitted
> in this way unless I start to see lots of ACKs from other developers.
> 
> When it gets to the point where multiple people are touching the
> driver in all sorts of ways, there needs to be someone to do all of
> the merging and making sure the patches get applied in the right order
> and handling merge conflicts handled properly.  Then they submit them
> formally here as a sane single set of patches to the list.
> 
> So who is going to step up and be the ep93xx-eth maintainer?  Lennert
> is listed in MAINTAINERS, but I see little to no activity from him.

Lennert, do you still have time, hardware and will to maintain that driver?

> 
> The last ACK Lennert gave for a patch to this driver was in May 2010,
> more than a year ago.

--
Florian
Lennert Buytenhek June 6, 2011, 5:34 p.m. UTC | #4
On Mon, Jun 06, 2011 at 07:15:52AM +0200, Florian Fainelli wrote:

> > Instead there are several different people submitting changes to
> > this one driver and I haven't got a clue who is authoritative and
> > who is not.
> > 
> > So 9 times out of ten I'm not going to merge anything submitted
> > in this way unless I start to see lots of ACKs from other developers.
> > 
> > When it gets to the point where multiple people are touching the
> > driver in all sorts of ways, there needs to be someone to do all of
> > the merging and making sure the patches get applied in the right order
> > and handling merge conflicts handled properly.  Then they submit them
> > formally here as a sane single set of patches to the list.
> > 
> > So who is going to step up and be the ep93xx-eth maintainer?  Lennert
> > is listed in MAINTAINERS, but I see little to no activity from him.
> 
> Lennert, do you still have time, hardware and will to maintain that driver?

I still have hardware, but I have been pretty short on time lately.
I'd be happy to hand over maintainership of this driver.
Petr Štetiar June 9, 2011, 8:30 p.m. UTC | #5
Florian Fainelli <f.fainelli@gmail.com> [2011-06-05 20:29:24]:

> On Sunday 05 June 2011 19:57:36 Florian Fainelli wrote:
> > ep93xx-eth lacked support for monitoring link status changes, with this
> > patch, link changes are now watched and reported correctly.
> > 
> > Signed-off-by: Florian Fainelli <florian@openwrt.org>
> > ---
> 
> I just stumbled upon: http://www.mail-
> archive.com/netdev@vger.kernel.org/msg62549.html
> which does not seem to have been merged.
> 
> I will respin my patch with Herbert's changes

Hi,

just FYI, I wanted to test recent Mika's DMA/ep93xx_eth fixes, so I've added
this patch also and it oopsed. If I revert this patch, it seems to work so
far. You can find the whole patchset I've been testing on the GitHub[1]. I've
tested it on ts-7250 and ts-7300, the oops is same. Here's the oops:

	ep93xx-eth version 0.1 loading
	ep93xx_eth_mii: probed
	ep93xx_eth:ep93xx_mii_probe: no PHY found
	ep93xx-eth ep93xx-eth: failed to probe MII bus
	------------[ cut here ]------------
	WARNING: at net/core/dev.c:5133 rollback_registered_many+0x90/0x2d4()
	Modules linked in:
	Backtrace: 
	[<c0027e78>] (dump_backtrace+0x0/0x10c) from [<c0263764>] (dump_stack+0x18/0x1c)
	 r6:0000140d r5:c01cd558 r4:00000000 r3:00000000
	[<c026374c>] (dump_stack+0x0/0x1c) from [<c0037a48>] (warn_slowpath_common+0x50/0x68)
	[<c00379f8>] (warn_slowpath_common+0x0/0x68) from [<c0037a84>] (warn_slowpath_null+0x24/0x2c)
	 r8:00100100 r7:00200200 r6:cf01bda0 r5:cf01bdf8 r4:cf0b6800
	r3:00000009
	[<c0037a60>] (warn_slowpath_null+0x0/0x2c) from [<c01cd558>] (rollback_registered_many+0x90/0x2d4)
	[<c01cd4c8>] (rollback_registered_many+0x0/0x2d4) from [<c01cd834>] (rollback_registered+0x30/0x48)
	 r8:00000027 r7:cf0b6800 r6:cf0b6b40 r5:00000000 r4:cf0b6800
	r3:cf0b6858
	[<c01cd804>] (rollback_registered+0x0/0x48) from [<c01cd8a8>] (unregister_netdevice_queue+0x5c/0xa8)
	[<c01cd84c>] (unregister_netdevice_queue+0x0/0xa8) from [<c01cd914>] (unregister_netdev+0x20/0x28)
	 r5:c030f638 r4:cf0b6800
	[<c01cd8f4>] (unregister_netdev+0x0/0x28) from [<c01b03a0>] (ep93xx_eth_remove+0x34/0x90)
	 r4:cf0b6800 r3:cf039180
	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>] (ep93xx_eth_probe+0x218/0x43c)
	 r5:c030f630 r4:ffffffed
	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>] (platform_drv_probe+0x1c/0x20)
	[<c018b79c>] (platform_drv_probe+0x0/0x20) from [<c018a5d0>] (driver_probe_device+0x8c/0x198)
	[<c018a544>] (driver_probe_device+0x0/0x198) from [<c018a770>] (__driver_attach+0x94/0x98)
	 r8:c0017d40 r7:00000000 r6:c030f66c r5:c032080c r4:c030f638
	r3:00000000
	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>] (bus_for_each_dev+0x60/0x88)
	 r6:00000000 r5:c018a6dc r4:c032080c r3:c018a6dc
	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>] (driver_attach+0x20/0x28)
	 r6:cf0ae860 r5:c031d4e0 r4:c032080c
	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>] (bus_add_driver+0xa4/0x240)
	[<c0189df0>] (bus_add_driver+0x0/0x240) from [<c018aae0>] (driver_register+0x80/0x144)
	[<c018aa60>] (driver_register+0x0/0x144) from [<c018baf0>] (platform_driver_register+0x4c/0x60)
	 r8:c0017d40 r7:00000000 r6:cf01a000 r5:c0325960 r4:c001ee3c
	r3:00000000
	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>] (ep93xx_eth_init_module+0x1c/0x28)
	[<c0017d40>] (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>] (do_one_initcall+0x3c/0x17c)
	[<c00244b4>] (do_one_initcall+0x0/0x17c) from [<c0008a04>] (kernel_init+0x9c/0x140)
	[<c0008968>] (kernel_init+0x0/0x140) from [<c003b158>] (do_exit+0x0/0x710)
	 r5:c0008968 r4:00000000
	---[ end trace edc3043606fef430 ]---
	network todo 'eth%d' but state 0
	Backtrace: 
	[<c0027e78>] (dump_backtrace+0x0/0x10c) from [<c0263764>] (dump_stack+0x18/0x1c)
	 r6:cf0b6b40 r5:c0312560 r4:cf0b6800 r3:00000000
	[<c026374c>] (dump_stack+0x0/0x1c) from [<c01d10e4>] (netdev_run_todo+0x2dc/0x33c)
	[<c01d0e08>] (netdev_run_todo+0x0/0x33c) from [<c01dd824>] (rtnl_unlock+0x10/0x14)
	[<c01dd814>] (rtnl_unlock+0x0/0x14) from [<c01cd918>] (unregister_netdev+0x24/0x28)
	[<c01cd8f4>] (unregister_netdev+0x0/0x28) from [<c01b03a0>] (ep93xx_eth_remove+0x34/0x90)
	 r4:cf0b6800 r3:cf039180
	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>] (ep93xx_eth_probe+0x218/0x43c)
	 r5:c030f630 r4:ffffffed
	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>] (platform_drv_probe+0x1c/0x20)
	[<c018b79c>] (platform_drv_probe+0x0/0x20) from [<c018a5d0>] (driver_probe_device+0x8c/0x198)
	[<c018a544>] (driver_probe_device+0x0/0x198) from [<c018a770>] (__driver_attach+0x94/0x98)
	 r8:c0017d40 r7:00000000 r6:c030f66c r5:c032080c r4:c030f638
	r3:00000000
	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>] (bus_for_each_dev+0x60/0x88)
	 r6:00000000 r5:c018a6dc r4:c032080c r3:c018a6dc
	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>] (driver_attach+0x20/0x28)
	 r6:cf0ae860 r5:c031d4e0 r4:c032080c
	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>] (bus_add_driver+0xa4/0x240)
	[<c0189df0>] (bus_add_driver+0x0/0x240) from [<c018aae0>] (driver_register+0x80/0x144)
	[<c018aa60>] (driver_register+0x0/0x144) from [<c018baf0>] (platform_driver_register+0x4c/0x60)
	 r8:c0017d40 r7:00000000 r6:cf01a000 r5:c0325960 r4:c001ee3c
	r3:00000000
	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>] (ep93xx_eth_init_module+0x1c/0x28)
	[<c0017d40>] (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>] (do_one_initcall+0x3c/0x17c)
	[<c00244b4>] (do_one_initcall+0x0/0x17c) from [<c0008a04>] (kernel_init+0x9c/0x140)
	[<c0008968>] (kernel_init+0x0/0x140) from [<c003b158>] (do_exit+0x0/0x710)
	 r5:c0008968 r4:00000000
	Unable to handle kernel NULL pointer dereference at virtual address 00000000
	pgd = c0004000
	[00000000] *pgd=00000000
	Internal error: Oops: 5 [#1] PREEMPT
	Modules linked in:
	CPU: 0    Tainted: G        W    (3.0.0-rc2+ #35)
	PC is at ep93xx_free_buffers+0x24/0xd4
	LR is at ep93xx_eth_remove+0x5c/0x90
	pc : [<c01b02bc>]    lr : [<c01b03c8>]    psr: 80000013
	sp : cf01be20  ip : cf01be40  fp : cf01be3c
	r10: 00000080  r9 : c0325bc8  r8 : 00000027
	r7 : c030f638  r6 : cf0b6b40  r5 : cf0b6b54  r4 : 00000000
	r3 : 00000000  r2 : 00000014  r1 : 00000800  r0 : cf0b6b40
	Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
	Control: c000717f  Table: 00004000  DAC: 00000017
	Process swapper (pid: 1, stack limit = 0xcf01a270)
	Stack: (0xcf01be20 to 0xcf01c000)
	be20: cf0b6800 cf0b6b40 cf0b6b40 cf0b6800 cf01be54 cf01be40 c01b03c8 c01b02a8
	be40: ffffffed c030f630 cf01be94 cf01be58 c01b1348 c01b037c 00000000 c032080c
	be60: c0017d40 c030f638 cf01be84 c030f638 c0340bd0 c030f638 c032080c c0017d40
	be80: 00000000 00000000 cf01bea4 cf01be98 c018b7b8 c01b1140 cf01becc cf01bea8
	bea0: c018a5d0 c018b7ac 00000000 c030f638 c032080c c030f66c 00000000 c0017d40
	bec0: cf01beec cf01bed0 c018a770 c018a554 c018a6dc c032080c c018a6dc 00000000
	bee0: cf01bf14 cf01bef0 c018974c c018a6ec cf02ebf8 cf0391b0 c01576c4 c032080c
	bf00: c031d4e0 cf0ae860 cf01bf24 cf01bf18 c018a2a8 c01896fc cf01bf54 cf01bf28
	bf20: c0189e94 c018a298 c02ce24c cf01bf38 c032080c c0325960 cf01a000 00000000
	bf40: c0017d40 00000000 cf01bf7c cf01bf58 c018aae0cf01bfe0 c0008a04 c00244c4
	bfe0: 00000000 c0008968 00000000 cf01bff8 c003b158 c0008978 e3a0105e e3a02030
	Backtrace: 
	[<c01b0298>] (ep93xx_free_buffers+0x0/0xd4) from [<c01b03c8>] (ep93xx_eth_remove+0x5c/0x90)
	 r7:cf0b6800 r6:cf0b6b40 r5:cf0b6b40 r4:cf0b6800
	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>] (ep93xx_eth_probe+0x218/0x43c)
	 r5:c030f630 r4:ffffffed
	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>] (platform_drv_probe+0x1c/0x20)
	[<c018b79c>] (platform_drv_probe+0x0/0x20) from [<c018a5d0>] (driver_probe_device+0x8c/0x198)
	[<c018a544>] (driver_probe_device+0x0/0x198) from [<c018a770>] (__driver_attach+0x94/0x98)
	 r8:c0017d40 r7:00000000 r6:c030f66c r5:c032080c r4:c030f638
	r3:00000000
	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>] (bus_for_each_dev+0x60/0x88)
	 r6:00000000 r5:c018a6dc r4:c032080c r3:c018a6dc
	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>] (driver_attach+0x20/0x28)
	 r6:cf0ae860 r5:c031d4e0 r4:c032080c
	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>] (bus_add_driver+0xa4/0x240)
	[<c0189df0>] (bus_add_driver+0x0/0x240) from [<c018aae0>] (driver_register+0x80/0x144)
	[<c018aa60>] (driver_register+0x0/0x144) from [<c018baf0>] (platform_driver_register+0x4c/0x60)
	 r8:c0017d40 r7:00000000 r6:cf01a000 r5:c0325960 r4:c001ee3c
	r3:00000000
	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>] (ep93xx_eth_init_module+0x1c/0x28)
	[<c0017d40>] (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>] (do_one_initcall+0x3c/0x17c)
	[<c00244b4>] (do_one_initcall+0x0/0x17c) from [<c0008a04>] (kernel_init+0x9c/0x140)
	[<c0008968>] (kernel_init+0x0/0x140) from [<c003b158>] (do_exit+0x0/0x710)
	 r5:c0008968 r4:00000000
	Code: e2805014 e3a04000 e5963010 e3a01b02 (e7933184) 
	---[ end trace edc3043606fef431 ]---
	Kernel panic - not syncing: Attempted to kill init!
	Backtrace: 
	[<c0027e78>] (dump_backtrace+0x0/0x10c) from [<c0263764>] (dump_stack+0x18/0x1c)
	 r6:00000000 r5:c0312c40 r4:c0325cc0 r3:00000002
	[<c026374c>] (dump_stack+0x0/0x1c) from [<c02637d0>] (panic+0x68/0x198)
	[<c0263768>] (panic+0x0/0x198) from [<c003b7cc>] (do_exit+0x674/0x710)
	 r3:c0312c40 r2:c003b754 r1:cf01a000 r0:c02cf148
	 r7:cf019be0
	[<c003b158>] (do_exit+0x0/0x710) from [<c00284e4>] (die+  cf0b6b40 00000800
	bde0: 00000014 00000000 00000000 cf0b6b54 cf0b6b40 c030f638 00000027 c0325bc8
	be00: 00000080 cf01be3c cf01be40 cf01be20 c01b03c8 c01b02bc 80000013 ffffffff
	 r8:00000027 r7:c030f638 r6:cf0b6b40 r5:cf01be0c r4:ffffffff
	[<c01b0298>] (ep93xx_free_buffers+0x0/0xd4) from [<c01b03c8>] (ep93xx_eth_remove+0x5c/0x90)
	 r7:cf0b6800 r6:cf0b6b40 r5:cf0b6b40 r4:cf0b6800
	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>] (ep93xx_eth_probe+0x218/0x43c)
	 r5:c030f630 r4:ffffffed
	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>] (platform_drv_probe+0x1c/0x20)
	[<c018b79c>] (platform_drv_probe+0x0/0x20) from [<c018a5d0>] (driver_probe_device+0x8c/0x198)
	[<c018a544>] (driver_probe_device+0x0/0x198) from [<c018a770>] (__driver_attach+0x94/0x98)
	 r8:c0017d40 r7:00000000 r6:c030f66c r5:c032080c r4:c030f638
	r3:00000000
	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>] (bus_for_each_dev+0x60/0x88)
	 r6:00000000 r5:c018a6dc r4:c032080c r3:c018a6dc
	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>] (driver_attach+0x20/0x28)
	 r6:cf0ae860 r5:c031d4e0 r4:c032080c
	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>] (bus_add_driver+0xa4/0x240)
	[<c0189df0>] (bus_add_driver+0x0/0x240) from [<c018aae0>] (driver_register+0x80/0x144)
	[<c018aa60>] (driver_register+0x0/0x144) from [<c018baf0>] (platform_driver_register+0x4c/0x60)
	 r8:c0017d40 r7:00000000 r6:cf01a000 r5:c0325960 r4:c001ee3c
	r3:00000000
	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>] (ep93xx_eth_init_module+0x1c/0x28)
	[<c0017d40>] (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>] (do_one_initcall+0x3c/0x17c)
	[<c00244b4>] (do_one_initcall+0x0/0x17c) from [<c0008a04>] (kernel_init+0x9c/0x140)
	[<c0008968>] (kernel_init+0x0/0x140) from [<c003b158>] (do_exit+0x0/0x710)
	 r5:c0008968 r4:00000000

1. https://github.com/ynezz/linux-2.6/commits/ts72xx-wip

-- ynezz
Florian Fainelli June 10, 2011, 9:46 a.m. UTC | #6
Hello Petr,

On Thursday 09 June 2011 22:30:59 Petr Štetiar wrote:
> Florian Fainelli <f.fainelli@gmail.com> [2011-06-05 20:29:24]:
> > On Sunday 05 June 2011 19:57:36 Florian Fainelli wrote:
> > > ep93xx-eth lacked support for monitoring link status changes, with this
> > > patch, link changes are now watched and reported correctly.
> > > 
> > > Signed-off-by: Florian Fainelli <florian@openwrt.org>
> > > ---
> > 
> > I just stumbled upon: http://www.mail-
> > archive.com/netdev@vger.kernel.org/msg62549.html
> > which does not seem to have been merged.
> > 
> > I will respin my patch with Herbert's changes
> 
> Hi,
> 
> just FYI, I wanted to test recent Mika's DMA/ep93xx_eth fixes, so I've
> added this patch also and it oopsed. If I revert this patch, it seems to
> work so far. You can find the whole patchset I've been testing on the
> GitHub[1]. I've tested it on ts-7250 and ts-7300, the oops is same. Here's
> the oops:

Allright, I need to respin the patch anyway, thanks for testing.

> 
> 	ep93xx-eth version 0.1 loading
> 	ep93xx_eth_mii: probed
> 	ep93xx_eth:ep93xx_mii_probe: no PHY found
> 	ep93xx-eth ep93xx-eth: failed to probe MII bus
> 	------------[ cut here ]------------
> 	WARNING: at net/core/dev.c:5133 rollback_registered_many+0x90/0x2d4()
> 	Modules linked in:
> 	Backtrace:
> 	[<c0027e78>] (dump_backtrace+0x0/0x10c) from [<c0263764>]
> (dump_stack+0x18/0x1c) r6:0000140d r5:c01cd558 r4:00000000 r3:00000000
> 	[<c026374c>] (dump_stack+0x0/0x1c) from [<c0037a48>]
> (warn_slowpath_common+0x50/0x68) [<c00379f8>]
> (warn_slowpath_common+0x0/0x68) from [<c0037a84>]
> (warn_slowpath_null+0x24/0x2c) r8:00100100 r7:00200200 r6:cf01bda0
> r5:cf01bdf8 r4:cf0b6800
> 	r3:00000009
> 	[<c0037a60>] (warn_slowpath_null+0x0/0x2c) from [<c01cd558>]
> (rollback_registered_many+0x90/0x2d4) [<c01cd4c8>]
> (rollback_registered_many+0x0/0x2d4) from [<c01cd834>]
> (rollback_registered+0x30/0x48) r8:00000027 r7:cf0b6800 r6:cf0b6b40
> r5:00000000 r4:cf0b6800
> 	r3:cf0b6858
> 	[<c01cd804>] (rollback_registered+0x0/0x48) from [<c01cd8a8>]
> (unregister_netdevice_queue+0x5c/0xa8) [<c01cd84c>]
> (unregister_netdevice_queue+0x0/0xa8) from [<c01cd914>]
> (unregister_netdev+0x20/0x28) r5:c030f638 r4:cf0b6800
> 	[<c01cd8f4>] (unregister_netdev+0x0/0x28) from [<c01b03a0>]
> (ep93xx_eth_remove+0x34/0x90) r4:cf0b6800 r3:cf039180
> 	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>]
> (ep93xx_eth_probe+0x218/0x43c) r5:c030f630 r4:ffffffed
> 	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>]
> (platform_drv_probe+0x1c/0x20) [<c018b79c>] (platform_drv_probe+0x0/0x20)
> from [<c018a5d0>] (driver_probe_device+0x8c/0x198) [<c018a544>]
> (driver_probe_device+0x0/0x198) from [<c018a770>]
> (__driver_attach+0x94/0x98) r8:c0017d40 r7:00000000 r6:c030f66c
> r5:c032080c r4:c030f638
> 	r3:00000000
> 	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>]
> (bus_for_each_dev+0x60/0x88) r6:00000000 r5:c018a6dc r4:c032080c
> r3:c018a6dc
> 	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>]
> (driver_attach+0x20/0x28) r6:cf0ae860 r5:c031d4e0 r4:c032080c
> 	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>]
> (bus_add_driver+0xa4/0x240) [<c0189df0>] (bus_add_driver+0x0/0x240) from
> [<c018aae0>] (driver_register+0x80/0x144) [<c018aa60>]
> (driver_register+0x0/0x144) from [<c018baf0>]
> (platform_driver_register+0x4c/0x60) r8:c0017d40 r7:00000000 r6:cf01a000
> r5:c0325960 r4:c001ee3c
> 	r3:00000000
> 	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>]
> (ep93xx_eth_init_module+0x1c/0x28) [<c0017d40>]
> (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>]
> (do_one_initcall+0x3c/0x17c) [<c00244b4>] (do_one_initcall+0x0/0x17c) from
> [<c0008a04>] (kernel_init+0x9c/0x140) [<c0008968>] (kernel_init+0x0/0x140)
> from [<c003b158>] (do_exit+0x0/0x710) r5:c0008968 r4:00000000
> 	---[ end trace edc3043606fef430 ]---
> 	network todo 'eth%d' but state 0
> 	Backtrace:
> 	[<c0027e78>] (dump_backtrace+0x0/0x10c) from [<c0263764>]
> (dump_stack+0x18/0x1c) r6:cf0b6b40 r5:c0312560 r4:cf0b6800 r3:00000000
> 	[<c026374c>] (dump_stack+0x0/0x1c) from [<c01d10e4>]
> (netdev_run_todo+0x2dc/0x33c) [<c01d0e08>] (netdev_run_todo+0x0/0x33c)
> from [<c01dd824>] (rtnl_unlock+0x10/0x14) [<c01dd814>]
> (rtnl_unlock+0x0/0x14) from [<c01cd918>] (unregister_netdev+0x24/0x28)
> [<c01cd8f4>] (unregister_netdev+0x0/0x28) from [<c01b03a0>]
> (ep93xx_eth_remove+0x34/0x90) r4:cf0b6800 r3:cf039180
> 	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>]
> (ep93xx_eth_probe+0x218/0x43c) r5:c030f630 r4:ffffffed
> 	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>]
> (platform_drv_probe+0x1c/0x20) [<c018b79c>] (platform_drv_probe+0x0/0x20)
> from [<c018a5d0>] (driver_probe_device+0x8c/0x198) [<c018a544>]
> (driver_probe_device+0x0/0x198) from [<c018a770>]
> (__driver_attach+0x94/0x98) r8:c0017d40 r7:00000000 r6:c030f66c
> r5:c032080c r4:c030f638
> 	r3:00000000
> 	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>]
> (bus_for_each_dev+0x60/0x88) r6:00000000 r5:c018a6dc r4:c032080c
> r3:c018a6dc
> 	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>]
> (driver_attach+0x20/0x28) r6:cf0ae860 r5:c031d4e0 r4:c032080c
> 	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>]
> (bus_add_driver+0xa4/0x240) [<c0189df0>] (bus_add_driver+0x0/0x240) from
> [<c018aae0>] (driver_register+0x80/0x144) [<c018aa60>]
> (driver_register+0x0/0x144) from [<c018baf0>]
> (platform_driver_register+0x4c/0x60) r8:c0017d40 r7:00000000 r6:cf01a000
> r5:c0325960 r4:c001ee3c
> 	r3:00000000
> 	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>]
> (ep93xx_eth_init_module+0x1c/0x28) [<c0017d40>]
> (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>]
> (do_one_initcall+0x3c/0x17c) [<c00244b4>] (do_one_initcall+0x0/0x17c) from
> [<c0008a04>] (kernel_init+0x9c/0x140) [<c0008968>] (kernel_init+0x0/0x140)
> from [<c003b158>] (do_exit+0x0/0x710) r5:c0008968 r4:00000000
> 	Unable to handle kernel NULL pointer dereference at virtual address
> 00000000 pgd = c0004000
> 	[00000000] *pgd=00000000
> 	Internal error: Oops: 5 [#1] PREEMPT
> 	Modules linked in:
> 	CPU: 0    Tainted: G        W    (3.0.0-rc2+ #35)
> 	PC is at ep93xx_free_buffers+0x24/0xd4
> 	LR is at ep93xx_eth_remove+0x5c/0x90
> 	pc : [<c01b02bc>]    lr : [<c01b03c8>]    psr: 80000013
> 	sp : cf01be20  ip : cf01be40  fp : cf01be3c
> 	r10: 00000080  r9 : c0325bc8  r8 : 00000027
> 	r7 : c030f638  r6 : cf0b6b40  r5 : cf0b6b54  r4 : 00000000
> 	r3 : 00000000  r2 : 00000014  r1 : 00000800  r0 : cf0b6b40
> 	Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
> 	Control: c000717f  Table: 00004000  DAC: 00000017
> 	Process swapper (pid: 1, stack limit = 0xcf01a270)
> 	Stack: (0xcf01be20 to 0xcf01c000)
> 	be20: cf0b6800 cf0b6b40 cf0b6b40 cf0b6800 cf01be54 cf01be40 c01b03c8
> c01b02a8 be40: ffffffed c030f630 cf01be94 cf01be58 c01b1348 c01b037c
> 00000000 c032080c be60: c0017d40 c030f638 cf01be84 c030f638 c0340bd0
> c030f638 c032080c c0017d40 be80: 00000000 00000000 cf01bea4 cf01be98
> c018b7b8 c01b1140 cf01becc cf01bea8 bea0: c018a5d0 c018b7ac 00000000
> c030f638 c032080c c030f66c 00000000 c0017d40 bec0: cf01beec cf01bed0
> c018a770 c018a554 c018a6dc c032080c c018a6dc 00000000 bee0: cf01bf14
> cf01bef0 c018974c c018a6ec cf02ebf8 cf0391b0 c01576c4 c032080c bf00:
> c031d4e0 cf0ae860 cf01bf24 cf01bf18 c018a2a8 c01896fc cf01bf54 cf01bf28
> bf20: c0189e94 c018a298 c02ce24c cf01bf38 c032080c c0325960 cf01a000
> 00000000 bf40: c0017d40 00000000 cf01bf7c cf01bf58 c018aae0cf01bfe0
> c0008a04 c00244c4 bfe0: 00000000 c0008968 00000000 cf01bff8 c003b158
> c0008978 e3a0105e e3a02030 Backtrace:
> 	[<c01b0298>] (ep93xx_free_buffers+0x0/0xd4) from [<c01b03c8>]
> (ep93xx_eth_remove+0x5c/0x90) r7:cf0b6800 r6:cf0b6b40 r5:cf0b6b40
> r4:cf0b6800
> 	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>]
> (ep93xx_eth_probe+0x218/0x43c) r5:c030f630 r4:ffffffed
> 	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>]
> (platform_drv_probe+0x1c/0x20) [<c018b79c>] (platform_drv_probe+0x0/0x20)
> from [<c018a5d0>] (driver_probe_device+0x8c/0x198) [<c018a544>]
> (driver_probe_device+0x0/0x198) from [<c018a770>]
> (__driver_attach+0x94/0x98) r8:c0017d40 r7:00000000 r6:c030f66c
> r5:c032080c r4:c030f638
> 	r3:00000000
> 	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>]
> (bus_for_each_dev+0x60/0x88) r6:00000000 r5:c018a6dc r4:c032080c
> r3:c018a6dc
> 	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>]
> (driver_attach+0x20/0x28) r6:cf0ae860 r5:c031d4e0 r4:c032080c
> 	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>]
> (bus_add_driver+0xa4/0x240) [<c0189df0>] (bus_add_driver+0x0/0x240) from
> [<c018aae0>] (driver_register+0x80/0x144) [<c018aa60>]
> (driver_register+0x0/0x144) from [<c018baf0>]
> (platform_driver_register+0x4c/0x60) r8:c0017d40 r7:00000000 r6:cf01a000
> r5:c0325960 r4:c001ee3c
> 	r3:00000000
> 	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>]
> (ep93xx_eth_init_module+0x1c/0x28) [<c0017d40>]
> (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>]
> (do_one_initcall+0x3c/0x17c) [<c00244b4>] (do_one_initcall+0x0/0x17c) from
> [<c0008a04>] (kernel_init+0x9c/0x140) [<c0008968>] (kernel_init+0x0/0x140)
> from [<c003b158>] (do_exit+0x0/0x710) r5:c0008968 r4:00000000
> 	Code: e2805014 e3a04000 e5963010 e3a01b02 (e7933184)
> 	---[ end trace edc3043606fef431 ]---
> 	Kernel panic - not syncing: Attempted to kill init!
> 	Backtrace:
> 	[<c0027e78>] (dump_backtrace+0x0/0x10c) from [<c0263764>]
> (dump_stack+0x18/0x1c) r6:00000000 r5:c0312c40 r4:c0325cc0 r3:00000002
> 	[<c026374c>] (dump_stack+0x0/0x1c) from [<c02637d0>] (panic+0x68/0x198)
> 	[<c0263768>] (panic+0x0/0x198) from [<c003b7cc>] (do_exit+0x674/0x710)
> 	 r3:c0312c40 r2:c003b754 r1:cf01a000 r0:c02cf148
> 	 r7:cf019be0
> 	[<c003b158>] (do_exit+0x0/0x710) from [<c00284e4>] (die+  cf0b6b40
> 00000800 bde0: 00000014 00000000 00000000 cf0b6b54 cf0b6b40 c030f638
> 00000027 c0325bc8 be00: 00000080 cf01be3c cf01be40 cf01be20 c01b03c8
> c01b02bc 80000013 ffffffff r8:00000027 r7:c030f638 r6:cf0b6b40 r5:cf01be0c
> r4:ffffffff
> 	[<c01b0298>] (ep93xx_free_buffers+0x0/0xd4) from [<c01b03c8>]
> (ep93xx_eth_remove+0x5c/0x90) r7:cf0b6800 r6:cf0b6b40 r5:cf0b6b40
> r4:cf0b6800
> 	[<c01b036c>] (ep93xx_eth_remove+0x0/0x90) from [<c01b1348>]
> (ep93xx_eth_probe+0x218/0x43c) r5:c030f630 r4:ffffffed
> 	[<c01b1130>] (ep93xx_eth_probe+0x0/0x43c) from [<c018b7b8>]
> (platform_drv_probe+0x1c/0x20) [<c018b79c>] (platform_drv_probe+0x0/0x20)
> from [<c018a5d0>] (driver_probe_device+0x8c/0x198) [<c018a544>]
> (driver_probe_device+0x0/0x198) from [<c018a770>]
> (__driver_attach+0x94/0x98) r8:c0017d40 r7:00000000 r6:c030f66c
> r5:c032080c r4:c030f638
> 	r3:00000000
> 	[<c018a6dc>] (__driver_attach+0x0/0x98) from [<c018974c>]
> (bus_for_each_dev+0x60/0x88) r6:00000000 r5:c018a6dc r4:c032080c
> r3:c018a6dc
> 	[<c01896ec>] (bus_for_each_dev+0x0/0x88) from [<c018a2a8>]
> (driver_attach+0x20/0x28) r6:cf0ae860 r5:c031d4e0 r4:c032080c
> 	[<c018a288>] (driver_attach+0x0/0x28) from [<c0189e94>]
> (bus_add_driver+0xa4/0x240) [<c0189df0>] (bus_add_driver+0x0/0x240) from
> [<c018aae0>] (driver_register+0x80/0x144) [<c018aa60>]
> (driver_register+0x0/0x144) from [<c018baf0>]
> (platform_driver_register+0x4c/0x60) r8:c0017d40 r7:00000000 r6:cf01a000
> r5:c0325960 r4:c001ee3c
> 	r3:00000000
> 	[<c018baa4>] (platform_driver_register+0x0/0x60) from [<c0017d5c>]
> (ep93xx_eth_init_module+0x1c/0x28) [<c0017d40>]
> (ep93xx_eth_init_module+0x0/0x28) from [<c00244f0>]
> (do_one_initcall+0x3c/0x17c) [<c00244b4>] (do_one_initcall+0x0/0x17c) from
> [<c0008a04>] (kernel_init+0x9c/0x140) [<c0008968>] (kernel_init+0x0/0x140)
> from [<c003b158>] (do_exit+0x0/0x710) r5:c0008968 r4:00000000
> 
> 1. https://github.com/ynezz/linux-2.6/commits/ts72xx-wip
> 
> -- ynezz
diff mbox

Patch

diff --git a/drivers/net/arm/Kconfig b/drivers/net/arm/Kconfig
index 39e1c0d..53d075e 100644
--- a/drivers/net/arm/Kconfig
+++ b/drivers/net/arm/Kconfig
@@ -51,7 +51,7 @@  config ARM_KS8695_ETHER
 config EP93XX_ETH
 	tristate "EP93xx Ethernet support"
 	depends on ARM && ARCH_EP93XX
-	select MII
+	select PHYLIB
 	help
 	  This is a driver for the ethernet hardware included in EP93xx CPUs.
 	  Say Y if you are building a kernel for EP93xx based devices.
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c
index 5a77001..4669b6c 100644
--- a/drivers/net/arm/ep93xx_eth.c
+++ b/drivers/net/arm/ep93xx_eth.c
@@ -24,6 +24,7 @@ 
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/slab.h>
+#include <linux/phy.h>
 
 #include <mach/hardware.h>
 
@@ -175,7 +176,11 @@  struct ep93xx_priv
 	struct net_device	*dev;
 	struct napi_struct	napi;
 
-	struct mii_if_info	mii;
+	struct mii_bus		*mii_bus;
+	struct phy_device	*phydev;
+	int			old_link;
+	int			old_duplex;
+	unsigned int		phy_addr;
 	u8			mdc_divisor;
 };
 
@@ -186,8 +191,9 @@  struct ep93xx_priv
 #define wrw(ep, off, val)	__raw_writew((val), (ep)->base_addr + (off))
 #define wrl(ep, off, val)	__raw_writel((val), (ep)->base_addr + (off))
 
-static int ep93xx_mdio_read(struct net_device *dev, int phy_id, int reg)
+static int ep93xx_mdiobus_read(struct mii_bus *bus, int phy_id, int reg)
 {
+	struct net_device *dev = bus->priv;
 	struct ep93xx_priv *ep = netdev_priv(dev);
 	int data;
 	int i;
@@ -210,8 +216,9 @@  static int ep93xx_mdio_read(struct net_device *dev, int phy_id, int reg)
 	return data;
 }
 
-static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int data)
+static int ep93xx_mdiobus_write(struct mii_bus *bus, int phy_id, int reg, u16 data)
 {
+	struct net_device *dev = bus->priv;
 	struct ep93xx_priv *ep = netdev_priv(dev);
 	int i;
 
@@ -224,8 +231,84 @@  static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int d
 		msleep(1);
 	}
 
-	if (i == 10)
+	if (i == 10) {
 		pr_info("mdio write timed out\n");
+		return -ETIMEDOUT;
+	}
+
+	return 0;
+}
+
+static int ep93xx_mdiobus_reset(struct mii_bus *bus)
+{
+	return 0;
+}
+
+static void ep93xx_adjust_link(struct net_device *dev)
+{
+	struct ep93xx_priv * ep = netdev_priv(dev);
+	struct phy_device *phydev = ep->phydev;
+	int status_changed = 0;
+
+	BUG_ON(!phydev);
+
+	if (ep->old_link != phydev->link) {
+		status_changed = 1;
+		ep->old_link = phydev->link;
+	}
+
+	if (phydev->link && (ep->old_duplex != phydev->duplex)) {
+		status_changed = 1;
+		ep->old_duplex = phydev->duplex;
+	}
+
+	if (status_changed) {
+		pr_info("%s: link %s", dev->name, phydev->link ?
+			"UP" : "DOWN");
+		if (phydev->link)
+			pr_cont(" - %d/%s", phydev->speed,
+			DUPLEX_FULL == phydev->duplex ? "full" : "half");
+		pr_cont("\n");
+	}
+}
+
+static int ep93xx_mii_probe(struct net_device *dev)
+{
+	struct ep93xx_priv * ep = netdev_priv(dev);
+	struct phy_device *phydev = NULL;
+
+	/* use platform supplied PHY address if valid */
+	if (ep->phy_addr)
+		phydev = ep->mii_bus->phy_map[ep->phy_addr];
+	else
+		phydev = phy_find_first(ep->mii_bus);
+
+	if (!phydev) {
+		pr_err("no PHY found\n");
+		return -ENODEV;
+	}
+
+	phydev = phy_connect(dev, dev_name(&phydev->dev), &ep93xx_adjust_link,
+					0, PHY_INTERFACE_MODE_MII);
+	if (IS_ERR(phydev)) {
+		pr_err("could not attach to PHY\n");
+		return PTR_ERR(phydev);
+	}
+
+	/* mask with MAC supported features */
+	phydev->supported &= PHY_BASIC_FEATURES;
+	phydev->advertising = phydev->supported;
+	ep->phydev = phydev;
+	ep->old_link = 0;
+	ep->old_duplex = -1;
+
+	pr_info("attached PHY driver [%s] "
+		"(mii_bus:phy_addr=%s)\n",
+		phydev->drv->name, dev_name(&phydev->dev));
+
+	phy_start(phydev);
+
+	return 0;
 }
 
 static int ep93xx_rx(struct net_device *dev, int processed, int budget)
@@ -570,7 +653,7 @@  static int ep93xx_start_hw(struct net_device *dev)
 	wrl(ep, REG_SELFCTL, ((ep->mdc_divisor - 1) << 9));
 
 	/* Does the PHY support preamble suppress?  */
-	if ((ep93xx_mdio_read(dev, ep->mii.phy_id, MII_BMSR) & 0x0040) != 0)
+	if ((ep93xx_mdiobus_read(ep->mii_bus, ep->phy_addr, MII_BMSR) & 0x0040) != 0)
 		wrl(ep, REG_SELFCTL, ((ep->mdc_divisor - 1) << 9) | (1 << 8));
 
 	/* Receive descriptor ring.  */
@@ -703,9 +786,11 @@  static int ep93xx_close(struct net_device *dev)
 static int ep93xx_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
 	struct ep93xx_priv *ep = netdev_priv(dev);
-	struct mii_ioctl_data *data = if_mii(ifr);
 
-	return generic_mii_ioctl(&ep->mii, data, cmd, NULL);
+	if (!ep->phydev)
+		return -ENODEV;
+
+	return phy_mii_ioctl(ep->phydev, ifr, cmd);
 }
 
 static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
@@ -717,25 +802,19 @@  static void ep93xx_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *i
 static int ep93xx_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
 	struct ep93xx_priv *ep = netdev_priv(dev);
-	return mii_ethtool_gset(&ep->mii, cmd);
+	return phy_ethtool_gset(ep->phydev, cmd);
 }
 
 static int ep93xx_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
 	struct ep93xx_priv *ep = netdev_priv(dev);
-	return mii_ethtool_sset(&ep->mii, cmd);
+	return phy_ethtool_sset(ep->phydev, cmd);
 }
 
 static int ep93xx_nway_reset(struct net_device *dev)
 {
 	struct ep93xx_priv *ep = netdev_priv(dev);
-	return mii_nway_restart(&ep->mii);
-}
-
-static u32 ep93xx_get_link(struct net_device *dev)
-{
-	struct ep93xx_priv *ep = netdev_priv(dev);
-	return mii_link_ok(&ep->mii);
+	return phy_start_aneg(ep->phydev);
 }
 
 static const struct ethtool_ops ep93xx_ethtool_ops = {
@@ -743,7 +822,7 @@  static const struct ethtool_ops ep93xx_ethtool_ops = {
 	.get_settings		= ep93xx_get_settings,
 	.set_settings		= ep93xx_set_settings,
 	.nway_reset		= ep93xx_nway_reset,
-	.get_link		= ep93xx_get_link,
+	.get_link		= ethtool_op_get_link,
 };
 
 static const struct net_device_ops ep93xx_netdev_ops = {
@@ -789,6 +868,11 @@  static int ep93xx_eth_remove(struct platform_device *pdev)
 
 	/* @@@ Force down.  */
 	unregister_netdev(dev);
+
+	mdiobus_unregister(ep->mii_bus);
+	kfree(ep->mii_bus->irq);
+	mdiobus_free(ep->mii_bus);
+
 	ep93xx_free_buffers(ep);
 
 	if (ep->base_addr != NULL)
@@ -811,7 +895,8 @@  static int ep93xx_eth_probe(struct platform_device *pdev)
 	struct ep93xx_priv *ep;
 	struct resource *mem;
 	int irq;
-	int err;
+	int err = 0;
+	int i;
 
 	if (pdev == NULL)
 		return -ENODEV;
@@ -849,13 +934,41 @@  static int ep93xx_eth_probe(struct platform_device *pdev)
 	}
 	ep->irq = irq;
 
-	ep->mii.phy_id = data->phy_id;
-	ep->mii.phy_id_mask = 0x1f;
-	ep->mii.reg_num_mask = 0x1f;
-	ep->mii.dev = dev;
-	ep->mii.mdio_read = ep93xx_mdio_read;
-	ep->mii.mdio_write = ep93xx_mdio_write;
+	ep->mii_bus = mdiobus_alloc();
+	if (!ep->mii_bus) {
+		dev_err(&pdev->dev, "Failed to allocate mdiobus\n");
+		goto err_out;
+	}
+
+	ep->phy_addr = data->phy_id;
+	ep->mii_bus->priv = dev;
+	ep->mii_bus->read = ep93xx_mdiobus_read;
+	ep->mii_bus->write = ep93xx_mdiobus_write;
+	ep->mii_bus->reset = ep93xx_mdiobus_reset;
+	ep->mii_bus->name = "ep93xx_eth_mii";
 	ep->mdc_divisor = 40;	/* Max HCLK 100 MHz, min MDIO clk 2.5 MHz.  */
+	snprintf(ep->mii_bus->id, MII_BUS_ID_SIZE, "%x",
+				(pdev->id != -1) ? pdev->id : 0);
+	ep->mii_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
+	if (!ep->mii_bus->irq) {
+		dev_err(&pdev->dev, "mii_bus irq allocation failed\n");
+		goto err_out;
+	}
+
+	for (i = 0; i < PHY_MAX_ADDR; i++)
+		ep->mii_bus->irq[i] = PHY_POLL;
+
+	err = mdiobus_register(ep->mii_bus);
+	if (err) {
+		dev_err(&pdev->dev, "Failed to register MII bus\n");
+		goto err_out;
+	}
+
+	err = ep93xx_mii_probe(dev);
+	if (err) {
+		dev_err(&pdev->dev, "failed to probe MII bus\n");
+		goto err_out;
+	}
 
 	if (is_zero_ether_addr(dev->dev_addr))
 		random_ether_addr(dev->dev_addr);