linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Get new_emac driver running on 405EP
@ 2008-04-14 17:38 M B
  2008-04-14 21:02 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 4+ messages in thread
From: M B @ 2008-04-14 17:38 UTC (permalink / raw)
  To: ppc-dev

Hi,
I'm trying to get the new_emac driver (linux 2.6.25-rc8) running on my
405EP board with a KSZ8721BT Micrel/Kendin PHY.
I've already found 2 problems/missing features:
1) 100 retries in __emac_mdio_read for the read to complete are
slightly too less. 101 seem to be enough. But we could add a bit more,
because there is no negative effect for faster chips.
2) On the 405EP only the MDIO pin of the emac0 is pinned out, so both
phys have to be accessed through this one. This affectes the mdio
read/write functions.

I've already hacked around this problems, but ethernet is still not working.
After bringing up the device dmesg is flooded with this section.
emac/plb/opb/ethernet@ef600800: link timer
emac/plb/opb/ethernet@ef600800: mdio_read(00,01)
emac/plb/opb/ethernet@ef600800: mdio_read -> 786d
emac/plb/opb/ethernet@ef600800: mdio_read(00,01)
emac/plb/opb/ethernet@ef600800: mdio_read -> 786d


Any ideas where I should start looking?

Best Regards

Markus


A ping doesn't work
==============

# ifconfig eth0 1.1.1.1
eth0: link is up, 100 FDX, pause enabled

# ping 1.1.1.1 -c1
PING 1.1.1.1 (1.1.1.1): 56 data bytes

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 0 packets received, 100% packet loss

No data gets transmitted
==================
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:C2:1E:AF:FE
          inet addr:1.1.1.1  Bcast:1.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:23

And no interrupts triggered
===================
# cat /proc/interrupts
           CPU0
 16:        737   UIC   Level     serial
 18:          0   UIC   Level     MAL TX EOB
 19:          0   UIC   Level     MAL RX EOB
 20:          0   UIC   Level     MAL SERR
 21:          0   UIC   Level     MAL TX DE
 22:          0   UIC   Level     MAL RX DE
BAD:          0


dmesg section after boot, debug level of emac driver is 3
=========================================

ef600400.serial: ttyS1 at MMIO 0xef600400 (irq = 17) is a 16550A
PPC 4xx OCP EMAC driver, version 3.54
mal/plb/mcmal: probe
mal/plb/mcmal: reset
mal/plb/mcmal: enable_irq
MAL v1 /plb/mcmal, 4 TX channels, 4 RX channels
emac/plb/opb/ethernet@ef600800: features     : 0x00000000 / 0x00000000
emac/plb/opb/ethernet@ef600800: tx_fifo_size : 2048 (2048 gige)
emac/plb/opb/ethernet@ef600800: rx_fifo_size : 4096 (4096 gige)
emac/plb/opb/ethernet@ef600800: max_mtu      : 1500
emac/plb/opb/ethernet@ef600800: OPB freq     : 66000000
mal/plb/mcmal: reg(80000000, 80000000)
emac/plb/opb/ethernet@ef600800: tx_desc ff100000
emac/plb/opb/ethernet@ef600800: rx_desc ff100800
emac/plb/opb/ethernet@ef600800: PHY maps 00000000 00000000
emac/plb/opb/ethernet@ef600800: configure
emac/plb/opb/ethernet@ef600800: reset
emac/plb/opb/ethernet@ef600800: rx_disable
emac/plb/opb/ethernet@ef600800: tx_disable
emac/plb/opb/ethernet@ef600800:  link = 1 duplex = 1, pause = 0, asym_pause = 0
emac/plb/opb/ethernet@ef600800: __emac_calc_base_mr1
emac/plb/opb/ethernet@ef600800: mdio_read(00,00)
emac/plb/opb/ethernet@ef600800: mdio_read -> 3100
emac/plb/opb/ethernet@ef600800: mdio_read(00,00)
emac/plb/opb/ethernet@ef600800: mdio_read -> 3100
emac/plb/opb/ethernet@ef600800: mdio_write(00,00,a100)
emac/plb/opb/ethernet@ef600800: mdio_read(00,00)
emac/plb/opb/ethernet@ef600800: mdio_read -> 3100
emac/plb/opb/ethernet@ef600800: mdio_read(00,02)
emac/plb/opb/ethernet@ef600800: mdio_read -> 0022
emac/plb/opb/ethernet@ef600800: mdio_read(00,03)
emac/plb/opb/ethernet@ef600800: mdio_read -> 1619
emac/plb/opb/ethernet@ef600800: mdio_read(00,01)
emac/plb/opb/ethernet@ef600800: mdio_read -> 7849
emac/plb/opb/ethernet@ef600800: mdio_read(00,00)
emac/plb/opb/ethernet@ef600800: mdio_read -> 3100
emac/plb/opb/ethernet@ef600800: mdio_write(00,00,0000)
emac/plb/opb/ethernet@ef600800: mdio_read(00,04)
emac/plb/opb/ethernet@ef600800: mdio_read -> 01e1
emac/plb/opb/ethernet@ef600800: mdio_write(00,04,0de1)
emac/plb/opb/ethernet@ef600800: mdio_read(00,00)
emac/plb/opb/ethernet@ef600800: mdio_read -> 0000
emac/plb/opb/ethernet@ef600800: mdio_write(00,00,1200)
emac/plb/opb/ethernet@ef600800: stats
eth0: EMAC-0 /plb/opb/ethernet@ef600800, MAC 00:50:c2:1e:af:fe
eth0: found Generic MII PHY (0x00)
emac/plb/opb/ethernet@ef600900: features     : 0x00000000 / 0x00000000
emac/plb/opb/ethernet@ef600900: tx_fifo_size : 2048 (2048 gige)
emac/plb/opb/ethernet@ef600900: rx_fifo_size : 4096 (4096 gige)
emac/plb/opb/ethernet@ef600900: max_mtu      : 1500
emac/plb/opb/ethernet@ef600900: OPB freq     : 66000000
mal/plb/mcmal: reg(20000000, 40000000)
emac/plb/opb/ethernet@ef600900: tx_desc ff100400
emac/plb/opb/ethernet@ef600900: rx_desc ff100c00
emac/plb/opb/ethernet@ef600900: PHY maps 00000020 00000001
emac/plb/opb/ethernet@ef600900: configure
emac/plb/opb/ethernet@ef600900: reset
emac/plb/opb/ethernet@ef600900: rx_disable
emac/plb/opb/ethernet@ef600900: tx_disable
emac/plb/opb/ethernet@ef600900:  link = 1 duplex = 1, pause = 0, asym_pause = 0
emac/plb/opb/ethernet@ef600900: __emac_calc_base_mr1
emac/plb/opb/ethernet@ef600900: mdio_read(01,00)
emac/plb/opb/ethernet@ef600900: mdio_read -> 3100
emac/plb/opb/ethernet@ef600900: mdio_read(01,00)
emac/plb/opb/ethernet@ef600900: mdio_read -> 3100
emac/plb/opb/ethernet@ef600900: mdio_write(01,00,a100)
emac/plb/opb/ethernet@ef600900: mdio_read(01,00)
emac/plb/opb/ethernet@ef600900: mdio_read -> 3100
emac/plb/opb/ethernet@ef600900: mdio_read(01,02)
emac/plb/opb/ethernet@ef600900: mdio_read -> 0022
emac/plb/opb/ethernet@ef600900: mdio_read(01,03)
emac/plb/opb/ethernet@ef600900: mdio_read -> 1619
emac/plb/opb/ethernet@ef600900: mdio_read(01,01)
emac/plb/opb/ethernet@ef600900: mdio_read -> 7849
emac/plb/opb/ethernet@ef600900: mdio_read(01,00)
emac/plb/opb/ethernet@ef600900: mdio_read -> 3100
emac/plb/opb/ethernet@ef600900: mdio_write(01,00,0000)
emac/plb/opb/ethernet@ef600900: mdio_read(01,04)
emac/plb/opb/ethernet@ef600900: mdio_read -> 01e1
emac/plb/opb/ethernet@ef600900: mdio_write(01,04,0de1)
emac/plb/opb/ethernet@ef600900: mdio_read(01,00)
emac/plb/opb/ethernet@ef600900: mdio_read -> 0000
emac/plb/opb/ethernet@ef600900: mdio_write(01,00,1200)
emac/plb/opb/ethernet@ef600900: stats
eth1: EMAC-1 /plb/opb/ethernet@ef600900, MAC 00:50:c2:1e:af:fd
eth1: found Generic MII PHY (0x01)
TCP cubic registered


Mal and emac sections of my device tree
==============================

		MAL: mcmal {
			compatible = "ibm,mcmal-405ep", "ibm,mcmal";
			dcr-reg = <180 62>;
			num-tx-chans = <4>;
			num-rx-chans = <4>;
			interrupt-parent = <&UIC0>;
			interrupts = <
				a 4 /* SERR */
				b 4 /* TXEOB */
				c 4 /* RXEOB */
				d 4 /* TXDE */
				e 4 /* RXDE */>;
		};

		POB0: opb {
			compatible = "ibm,opb-405ep", "ibm,opb";
			#address-cells = <1>;
			#size-cells = <1>;
			ranges = <ef600000 ef600000 a00000>;
			dcr-reg = <0a0 5>;
			clock-frequency = <3EF1480>;

			EMAC0: ethernet@ef600800 {
				linux,network-index = <0>;
				device_type = "network";
				compatible = "ibm,emac-405ep", "ibm,emac";
				interrupt-parent = <&UIC0>;
				interrupts = <
					f 4 /* Ethernet */
					9 4 /* Ethernet Wake Up */>;
				local-mac-address = [0050c21eaffe]; /* Filled in by zImage */
				reg = <ef600800 70>;
				mal-device = <&MAL>;
				mal-tx-channel = <0>;
				mal-rx-channel = <0>;
				cell-index = <0>;
				max-frame-size = <5dc>;
				rx-fifo-size = <1000>;
				tx-fifo-size = <800>;
				phy-mode = "mii";
				phy-map = <00000000>;
			};

			EMAC1: ethernet@ef600900 {
				linux,network-index = <1>;
				device_type = "network";
				compatible = "ibm,emac-405ep", "ibm,emac";
				interrupt-parent = <&UIC0>;
				interrupts = <
					11 4 /* Ethernet */
					9 4 /* Ethernet Wake Up */>;
				local-mac-address = [0050c21eaffd]; /* Filled in by zImage */
				reg = <ef600900 70>;
				mal-device = <&MAL>;
				mal-tx-channel = <2>;
				mal-rx-channel = <1>;
				cell-index = <1>;
				max-frame-size = <5dc>;
				rx-fifo-size = <1000>;
				tx-fifo-size = <800>;
				phy-mode = "mii";
				phy-map = <00000020>;
			};


Kconfig section of emac
=================

CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
# CONFIG_MARVELL_PHY is not set
# CONFIG_DAVICOM_PHY is not set
# CONFIG_QSEMI_PHY is not set
# CONFIG_LXT_PHY is not set
# CONFIG_CICADA_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_SMSC_PHY is not set
# CONFIG_BROADCOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_REALTEK_PHY is not set
# CONFIG_FIXED_PHY is not set
# CONFIG_MDIO_BITBANG is not set
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
# CONFIG_ENC28J60 is not set
CONFIG_IBM_NEW_EMAC=y
CONFIG_IBM_NEW_EMAC_RXB=128
CONFIG_IBM_NEW_EMAC_TXB=64
CONFIG_IBM_NEW_EMAC_POLL_WEIGHT=32
CONFIG_IBM_NEW_EMAC_RX_COPY_THRESHOLD=256
CONFIG_IBM_NEW_EMAC_RX_SKB_HEADROOM=0
CONFIG_IBM_NEW_EMAC_DEBUG=y
# CONFIG_IBM_NEW_EMAC_ZMII is not set
# CONFIG_IBM_NEW_EMAC_RGMII is not set
# CONFIG_IBM_NEW_EMAC_TAH is not set
# CONFIG_IBM_NEW_EMAC_EMAC4 is not set

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Get new_emac driver running on 405EP
  2008-04-14 17:38 Get new_emac driver running on 405EP M B
@ 2008-04-14 21:02 ` Benjamin Herrenschmidt
  2008-04-15 21:51   ` Markus Brunner
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-14 21:02 UTC (permalink / raw)
  To: M B; +Cc: ppc-dev


On Mon, 2008-04-14 at 19:38 +0200, M B wrote:
> Hi,
> I'm trying to get the new_emac driver (linux 2.6.25-rc8) running on my
> 405EP board with a KSZ8721BT Micrel/Kendin PHY.
> I've already found 2 problems/missing features:
> 1) 100 retries in __emac_mdio_read for the read to complete are
> slightly too less. 101 seem to be enough. But we could add a bit more,
> because there is no negative effect for faster chips.
> 2) On the 405EP only the MDIO pin of the emac0 is pinned out, so both
> phys have to be accessed through this one. This affectes the mdio
> read/write functions.

The later can easily be described in the device-tree as it's a fairly
common setup.

> I've already hacked around this problems, but ethernet is still not working.
> After bringing up the device dmesg is flooded with this section.
> emac/plb/opb/ethernet@ef600800: link timer
> emac/plb/opb/ethernet@ef600800: mdio_read(00,01)
> emac/plb/opb/ethernet@ef600800: mdio_read -> 786d
> emac/plb/opb/ethernet@ef600800: mdio_read(00,01)
> emac/plb/opb/ethernet@ef600800: mdio_read -> 786d
> 
> 
> Any ideas where I should start looking?

The above is the timer polling the link, you may want to remove that
debug once it looks sane.

Ben.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Get new_emac driver running on 405EP
  2008-04-14 21:02 ` Benjamin Herrenschmidt
@ 2008-04-15 21:51   ` Markus Brunner
  2008-04-16  1:43     ` Josh Boyer
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Brunner @ 2008-04-15 21:51 UTC (permalink / raw)
  To: benh; +Cc: ppc-dev

On Monday 14 April 2008, Benjamin Herrenschmidt wrote:
> > 2) On the 405EP only the MDIO pin of the emac0 is pinned out, so both
> > phys have to be accessed through this one. This affectes the mdio
> > read/write functions.
>
> The later can easily be described in the device-tree as it's a fairly
> common setup.

mdio-device does the trick. This feature wasn't used by any other board in the 
kernel yet.

I made another error. I did mix up the order of the MAL irqs, so the irq 
handlers went mad. This was detected as a soft lock-up.

After correcting that both emacs are working on ppc405EP :).

Regards

Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Get new_emac driver running on 405EP
  2008-04-15 21:51   ` Markus Brunner
@ 2008-04-16  1:43     ` Josh Boyer
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Boyer @ 2008-04-16  1:43 UTC (permalink / raw)
  To: Markus Brunner; +Cc: ppc-dev

On Tue, 2008-04-15 at 23:51 +0200, Markus Brunner wrote:
> On Monday 14 April 2008, Benjamin Herrenschmidt wrote:
> > > 2) On the 405EP only the MDIO pin of the emac0 is pinned out, so both
> > > phys have to be accessed through this one. This affectes the mdio
> > > read/write functions.
> >
> > The later can easily be described in the device-tree as it's a fairly
> > common setup.
> 
> mdio-device does the trick. This feature wasn't used by any other board in the 
> kernel yet.
> 
> I made another error. I did mix up the order of the MAL irqs, so the irq 
> handlers went mad. This was detected as a soft lock-up.
> 
> After correcting that both emacs are working on ppc405EP :).

Cool.  Btw, new board ports are welcome :).

josh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-16  1:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-14 17:38 Get new_emac driver running on 405EP M B
2008-04-14 21:02 ` Benjamin Herrenschmidt
2008-04-15 21:51   ` Markus Brunner
2008-04-16  1:43     ` Josh Boyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).