Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 15 Jul 2013 20:52:54 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        hiren panchasara <hiren.panchasara@gmail.com>
Cc:        freebsd-embedded <freebsd-embedded@freebsd.org>
Subject:   Re: Making Picostation m2HP work
Message-ID:  <CAJ-VmokPNDgkdziRFr3-MnDZudskGb0ykRk9jfY1nWhrxBZEKw@mail.gmail.com>
In-Reply-To: <CALCpEUG4FR2qugb-ZYHG%2BJ7xcOL34edkPx41yOwU7qK-BynGOw@mail.gmail.com>
References:  <CALCpEUHxqyZb1Y5WqsuxjvwY2Pd_xN2%2BoTgsew0DwdRMC6=5Nw@mail.gmail.com> <CAJ-VmomtCNq3KUjVfcaLGjnSLjnvBWKzARs8TzebmN9MdMFkcA@mail.gmail.com> <CALCpEUGmtpVL=Y5Uqiz_h4%2BKgBDH9%2B=vC_DJHyU5rvOGOdiSag@mail.gmail.com> <CALCpEUE%2BDMq9KYBNZfJLx6DTxAY%2B1gv3uLQ3OtO-N1W1zRKL=Q@mail.gmail.com> <CAJ-VmokNR6VzdG7EC0jpEQN40He%2BUR=Y99dmzakXMfO3ojHjqw@mail.gmail.com> <CALCpEUFiQp-UrZHe9X-zxneQUc9p%2BX1Ojbp0F865a1QTPicp%2Bg@mail.gmail.com> <CALCpEUGbk8mCFqOUp6WxfdcH-kveudG-f4S0muUg4aYy0uqBtA@mail.gmail.com> <CAJ-VmomsSBSs9QumGc6z=aYQ0OUqjGcxBnnsy%2B1NR_F83KUzxg@mail.gmail.com> <CALCpEUG4FR2qugb-ZYHG%2BJ7xcOL34edkPx41yOwU7qK-BynGOw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Right,

you have to get the mdio bus configured up right, then attach arswitch to it.

Then you tell arge0/arge1 what PHY it speaks to, via Stefan's mdioproxy stuff.

_then_ arge0/arge1 will come up.

Now, as for how you do that - i'd have to re-read the datasheet and
write some documentation:

* one of them (I think arge0) is directly glued to arswitch with no
PHY per se - it's hard-programmed with a MIIbus mode (RMGII I think?)
and 100/full or 1000/full
* the other (i think arge1) connects to a PHY inside the switch, and
so you use mdioproxy to connect it to that PHY

arge1 doesn't _have_ to be connected to a dedicated PHY (ie, the "WAN"
port), it can be put into monitor mode and all the external ports can
just map to arge0 as switch ports. But that's not what arswitch
supports just yet, so I'm ignoring it.

Now, the tricky crap:

* there's an mdio bus (arge0 for 7240, arge1 for 7241.. or is the
other way around) that the internal switch sits on
* the switch has _its own_ internal MII bus for all the PHYs that it
has - ie, what faces external
* when arswitch probe/attaches, it'll export _another_ MII bus that
represents this internal bus..
* .. and then that bus is enumerated to find individual ukphy (generic
PHYs) for each of the physical ports
* This is limited to the first 4 ports I think; as the fifth port is
the WAN phy.

Then arge1 is glued to this "WAN" PHY. It's not owned by arswitch (but
it could be!) as then arge1 couldn't link to it to get notifications
about link, speed/duplex changes.

I'll follow this up with a post explaining how the miibus, mdiobus,
mdioproxy stuff and how arswitch is configured. Then I'll braindump
that into the wiki.



adrian


On 15 July 2013 15:14, hiren panchasara <hiren.panchasara@gmail.com> wrote:
> On Mon, Jul 15, 2013 at 1:49 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>> Right, this is a good start.
>>
>> Now:
>>
>> * the arswitch didn't attach PHYs, for some reason
> I think loos@ wanted to look at that.
>> * arge0/arge1 complained, again for some reason
> Let's start with this.
>> * and there's no wifi yet, which we can easily fix.
> And then this.
>>
>> So, which would you like to tackle first?
>
> Thanks :-)
> Hiren
>>
>>
>>
>> -adrian
>>
>>
>> On 15 July 2013 13:03, hiren panchasara <hiren.panchasara@gmail.com> wrote:
>>> On Mon, Jul 15, 2013 at 12:54 PM, hiren panchasara
>>> <hiren.panchasara@gmail.com> wrote:
>>>> On Mon, Jul 15, 2013 at 12:19 PM, Adrian Chadd <adrian@freebsd.org> wrote:
>>>>> ... only one # ? There should be pages of it.
>>>>>
>>>>> Once you do a tftpboot, do a printenv . Let's look at what uboot has
>>>>> set "filesize" to.
>>>>
>>>> Agrrh...I am so dumb. kernel.AP91 is empty. Somehow I nuked it.
>>>> Rebuilding it and retrying.
>>>
>>> Alright, it seems to be doing things. This is what I did with Adrian's scripts:
>>>
>>> # cd work/freebsd/head/src/
>>> # ../build/build/bin/build ap91 buildkernel
>>> # ../build/build/bin/build ap91 installkernel
>>>
>>> And then:
>>>
>>> ar7240> tftpboot 0x80050000 kernel.AP91
>>> Using eth0 device
>>> TFTP from server 192.168.1.254; our IP address is 192.168.1.20
>>> Filename 'kernel.AP91'.
>>> Load address: 0x80050000
>>> Loading: #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          #################################################################
>>>          ###############################################################
>>> done
>>> Bytes transferred = 3647659 (37a8ab hex)
>>> ar7240> go 80050100
>>> ## Starting application at 0x80050100 ...
>>> CPU platform: Atheros AR7241 rev 1
>>> CPU Frequency=390 MHz
>>> CPU DDR Frequency=390 MHz
>>> CPU AHB Frequency=195 MHz
>>> platform frequency: 390000000
>>> CPU reference clock: 5 MHz
>>> arguments:
>>>   a0 = 00000001
>>>   a1 = 81f4fcbc
>>>   a2 = 00000010
>>>   a3 = fffffffe
>>> Cmd line:argv is invalid
>>> Environment:
>>> envp is invalid
>>> Cache info:
>>>   picache_stride    = 4096
>>>   picache_loopcount = 16
>>>   pdcache_stride    = 4096
>>>   pdcache_loopcount = 8
>>> cpu0: MIPS Technologies processor v116.147
>>>   MMU: Standard TLB, 16 entries
>>>   L1 i-cache: 4 ways of 512 sets, 32 bytes per line
>>>   L1 d-cache: 4 ways of 256 sets, 32 bytes per line
>>>   Config1=0x9ee3519e<PerfCount,WatchRegs,MIPS16,EJTAG>
>>>   Config3=0x20
>>> KDB: debugger backends: ddb
>>> KDB: current backend: ddb
>>> Copyright (c) 1992-2013 The FreeBSD Project.
>>> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
>>>         The Regents of the University of California. All rights reserved.
>>> FreeBSD is a registered trademark of The FreeBSD Foundation.
>>> FreeBSD 10.0-CURRENT #0 r252757M: Wed Dec 31 16:00:00 PST 1969
>>>     hirenp@dummy:/usr/home/hirenp/work/freebsd/head/obj/mipseb/mips.mips/usr/home/hirenp/work/freebsd/head/src/sys/AP91
>>> mips
>>> gcc version 4.2.1 20070831 patched [FreeBSD]
>>> real memory  = 16777216 (16384K bytes)
>>> avail memory = 11968512 (11MB)
>>> random device not loaded; using insecure entropy
>>> nexus0: <MIPS32 root nexus>
>>> nexus0: failed to add child: arge0
>>> clock0: <Generic MIPS32 ticker> on nexus0
>>> Timecounter "MIPS32" frequency 195000000 Hz quality 800
>>> Event timer "MIPS32" frequency 195000000 Hz quality 800
>>> argemdio0: <Atheros AR71xx built-in ethernet interface, MDIO
>>> controller> at mem 0x19000000-0x19000fff on nexus0
>>> mdio0: <MDIO> on argemdio0
>>> mdioproxy0: <MII/MDIO proxy, MDIO side> on mdio0
>>> arswitch0: <Atheros AR7240 Ethernet Switch> on mdio0
>>> arswitch0: attaching PHY 0 failed
>>> arswitch0: attaching PHY 1 failed
>>> arswitch0: attaching PHY 2 failed
>>> arswitch0: attaching PHY 3 failed
>>> device_attach: arswitch0 attach returned 6
>>> apb0 at irq 4 on nexus0
>>> uart0: <16550 or compatible> on apb0
>>> uart0: console (115200,n,8,1)
>>> pcib0 at irq 0 on nexus0
>>> pcib0: found EEPROM at 0x1fff1000 on 0.0.0
>>> pcib0: EEPROM firmware: 0x1fff1000 @ 4096 bytes
>>> pcib0: device EEPROM 'pcib.0.bus.0.0.0.eeprom_firmware' registered
>>> pci0: <PCI bus> on pcib0
>>> pci0: <network> at device 0.0 (no driver attached)
>>> arge0: <Atheros AR71xx built-in ethernet interface> at mem
>>> 0x19000000-0x19000fff irq 2 on nexus0
>>> miiproxy0: <MII/MDIO proxy, MII side> on arge0
>>> arge0: can't attach proxy
>>> arge0: finishing attachment, phymask 0010, proxy null
>>> arge0: unable to attach PHY 4: 6
>>> device_attach: arge0 attach returned 6
>>> arge1: <Atheros AR71xx built-in ethernet interface> at mem
>>> 0x1a000000-0x1a000fff irq 3 on nexus0
>>> arge1: finishing attachment, phymask 0000, proxy null
>>> arge1: Ethernet address: 62:73:64:4e:10:78
>>> spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
>>> spibus0: <spibus bus> on spi0
>>> mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
>>> mx25l0: w25q64, sector 65536 bytes, 128 sectors
>>> ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
>>> ar71xx_wdog0: Previous reset was due to watchdog timeout
>>> Timecounters tick every 1.000 msec
>>> Trying to mount root from ufs:/dev/map/rootfs.uncompress []...
>>> mountroot: waiting for device /dev/map/rootfs.uncompress ...
>>> Mounting from ufs:/dev/map/rootfs.uncompress failed with error 19.
>>>
>>> Loader variables:
>>>
>>> Manual root filesystem specification:
>>>   <fstype>:<device> [options]
>>>       Mount <device> using filesystem <fstype>
>>>       and with the specified (optional) option list.
>>>
>>>     eg. ufs:/dev/da0s1a
>>>         zfs:tank
>>>         cd9660:/dev/acd0 ro
>>>           (which is equivalent to: mount -t cd9660 -o ro /dev/acd0 /)
>>>
>>>   ?               List valid disk boot devices
>>>   .               Yield 1 second (for background tasks)
>>>   <empty line>    Abort manual input
>>>
>>> mountroot>
>>>>
>>>> Hiren.
>>>>>
>>>>>
>>>>>
>>>>> -adrian
>>>>>
>>>> <skip>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmokPNDgkdziRFr3-MnDZudskGb0ykRk9jfY1nWhrxBZEKw>