Hi,

I hope you don't mind if I move the discussion back to openwrt-devel.
Answering only you wasn't intentional; I changed my default now to
"reply all" so it doesn't happen again.

On 7 April 2010 17:12, Gabor Juhos <juh...@openwrt.org> wrote:
> Jonas Gorski írta:
>> On 6 April 2010 17:30, Gabor Juhos <juh...@openwrt.org> wrote:
>>> Nah, it was not "broken". The AR8216 driver was disabled by default because
>>> it is not usable on the AR913x based boards. The reason behind this is that
>>> you can't communicate with the switch via the MDIO bus, because its speed
>>> is too fast for the switch.
>>
>> I meant broken in the sense that the ag71xx driver ignored if the phy_device
>> provided its own netif_rx/netif_receive_skb for packet mangling (as the
>> ar8216 driver has).
>
> Ok.
>
>>> To be precise, there is yet another solution: configuring the AR8216 switch
>>> with special ethernet packets.
>>
>> I see. At least the WNR2000 v2's u-boot code seems to use the MDIO bus to
>> configure the switch.
>
> The WRN2000 v2 is based on the AR7240.

Okay, that explains it.

>> But I also saw the special register read/write packet handling in some
>> atheros' S26 uboot implementations.
>
> Yeah, it is available in several GPL tarballs.
>
>>> The automatic detection won't work with this switch due to the MDIO bus
>>> issue, so it won't be registered never. At the end, you can't use the
>>> netif_rx function of the phy device.
>>
>> If it doesn't get detected, this really is a non issue.
>
> Well, this is not true totally. I did try it on several boards, and it looks
> strange:

That's the kind of feedback I had hoped for /before/ the patch got committed ;-)

> ---
>
> Planex MZK-W300NH:
> (Atheros AR9130 rev 1, CPU:400.000 MHz, AHB:200.000 MHz, DDR:400.000 MHz)
>
> 1st boot:
>> 0x000000050000-0x0000007c0000 : "firmware"
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ag71xx_mdio: probed
>> eth0: Atheros AG71xx at 0xb9000000, irq 4
>> eth1: Atheros AG71xx at 0xba000000, irq 5
>> Atheros AR71xx hardware watchdog driver version 0.1.0
>
> 2nd boot:
>> 0x000000050000-0x0000007c0000 : "firmware"
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ag71xx_mdio: probed
>> eth0: Atheros AG71xx at 0xb9000000, irq 4
>> eth1: Atheros AG71xx at 0xba000000, irq 5
>> Atheros AR71xx hardware watchdog driver version 0.1.0
>
> 3rd boot:
>> 0x000000050000-0x0000007c0000 : "firmware"
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> ag71xx_mdio: probed
>> eth0: Atheros AG71xx at 0xb9000000, irq 4
>> eth1: Atheros AG71xx at 0xba000000, irq 5
>> ar8216: Unknown Atheros device [ver=16777215, rev=255, phy_id=004dd042]
>> eth1: AR0 PHY driver attached.
>> Atheros AR71xx hardware watchdog driver version 0.1.0
>
> The ar8216 messages are ugly, and i bet that users will open tickets due to 
> this.

Okay, it seems it sometimes *does* work, and sometimes doesn't.
Perhaps demoting the level to KERN_DEBUG would be better.

>
> ---
>
> TRENDnet TEW-632BRP:
> (Atheros AR9130 rev 1, CPU:400.000 MHz, AHB:100.000 MHz, DDR:400.000 MHz)
>
>> 0x000000030000-0x0000003f0000 : "firmware"
>> ag71xx_mdio: probed
>> eth0: Atheros AG71xx at 0xb9000000, irq 4
>> eth1: Atheros AG71xx at 0xba000000, irq 5
>> eth1: AR8216 PHY driver attached.
>> Atheros AR71xx hardware watchdog driver version 0.1.0
>
> The switch is detected on the WAN interface at every boot. It is confusing a
> bit. Ethernet seems to be working, but the switch is not configurable via 
> swconfig.

Looking at the mach-tew-632brp.c, I guess the switch cpu port is
attached to eth0, and eth1 is the WAN port. This is under the
assumption it is usable like the ar8316.
To prevent a false switch on the wan interface, the driver register
itself as switch only if the phy address is 0.
The problem probably here is that eth0 doesn't have a phy_mask,
therefore the ag71xx never calls phy_connect() for it. Defining a
phy_mask should fix it.

And perhaps outputting whether the driver attached in switch mode or
in simple phy mode would be helpful.

> ---
>
> Planex MZK-W04NU:
> (Atheros AR9132 rev 1, CPU:400.000 MHz, AHB:100.000 MHz, DDR:400.000 MHz)
>
> The AHB bus runs 200MHz originally on this device, but i have a patched
> bootloader. Additionaly, i have modified the phy mask for the ethernet 
> interface.
>
>> 0x000000050000-0x0000007c0000 : "firmware"
>> ag71xx_mdio: probed
>> eth0: Atheros AG71xx at 0xb9000000, irq 4
>> eth0: AR8216 PHY driver attached.
>> eth1: Atheros AG71xx at 0xba000000, irq 5
>> eth1: AR8216 PHY driver attached.
>> Atheros AR71xx hardware watchdog driver version 0.1.0
>
> The switch is detected on both interfaces, and it is configurable with 
> swconfig.
> But both LAN and WAN ports are stops working after i have configured the 
> switch.

Okay, in that case, you are probably bitten by the problem I described
and wrote a patch for, although I am a bit stumped why the WAN port
stopped working.

Perhaps an easier workaround would be to unconditionally enable header
mode for the ar8216, the special netif_receive_skb() handling wouldn't
be needed anymore. Although this would disable the invalid VID fixup.

>> I also just saw that all 3 devices having 'has_ar8216' do not have a phy_mask
>> defined, so the driver never has a chance to attach anyway.
>
> Incorrect, see above.

You are right, they still have for the WAN port where it attaches itself.

Looking at the TEW-632BRP, I assume its bootloader doesn't enable the
header mode? It doesn't have the 'has_ar8216' flag set.

Can you check with the attached patch if it helps the Planex MZK-W04NU?

Regards,
Jonas Gorski

Attachment: always_enable_header.patch
Description: Binary data

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to