Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Mar 2014 17:36:42 +0100
From:      Milan Obuch <freebsd-mips@dino.sk>
To:        Adrian Chadd <adrian@freebsd.org>
Cc:        freebsd-mips@freebsd.org
Subject:   Re: I (think) the AR8327 switch support now works
Message-ID:  <20140308173642.0a48d2c2@zeta.dino.sk>
In-Reply-To: <CAJ-VmokM5mPxMbbVyaSpyDcn-Fs32g4heWMPZF7n2OpnFK31oA@mail.gmail.com>
References:  <CAJ-Vmok0cVLnH9DQh%2Bz6XF-NQmPKy_Ez37kLtuCSRThwjQHTJQ@mail.gmail.com> <20140301143607.13a96bd6@zeta.dino.sk> <CAJ-Vmom2coTLFn0zcTa=BzxAOopMjCDUBOtQwOVOyQmCeB19wA@mail.gmail.com> <20140301200546.7ff373d1@zeta.dino.sk> <20140301231239.023b8733@zeta.dino.sk> <CAJ-VmoknT-SWVmcDX-Cx8StUVuZNX%2BqNPzLcMBdLxN7qwssNoA@mail.gmail.com> <20140307140432.0a460da1@zeta.dino.sk> <CAJ-Vmok-nF4QdVmUMGJxt4tX=X%2Bvc4_-G100ZPRnQ-2aWyNCog@mail.gmail.com> <20140307204230.3c86b9b1@zeta.dino.sk> <CAJ-Vmo=B0CG1FSCKYeaCmORJuWbJ24g=%2BQkHV7WC8DTV9m1zKA@mail.gmail.com> <20140308140901.19782009@zeta.dino.sk> <CAJ-VmokM5mPxMbbVyaSpyDcn-Fs32g4heWMPZF7n2OpnFK31oA@mail.gmail.com>

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

[-- Attachment #1 --]
On Sat, 8 Mar 2014 07:44:44 -0800
Adrian Chadd <adrian@freebsd.org> wrote:

> Hm,
> 
> On 8 March 2014 05:09, Milan Obuch <freebsd-mips@dino.sk> wrote:
> > On Sat, 8 Mar 2014 00:55:38 -0800
> > Adrian Chadd <adrian@freebsd.org> wrote:
> >
> >> Look at if_arge.c - arge_fetch_mdiobus_clock_rate() . See whether
> >> the openwrt config sets the mdiobus frequency to something.
> >>
> >> The AR9344 defaults to 'MAC_MII_CFG_CLOCK_DIV_58'.
> >>
> >> Maybe you can fiddle with which divisor it uses.
> >>
> >>
> >> -a
> >>
> >
> > OK, I will try to look there, but in between, some outcome from my
> > tests.
> >
> > 1. AR8327 does not teel much - all I can see there is just
> >
> > argemdio0: <Atheros AR71xx built-in ethernet interface, MDIO
> > controller> at mem 0x19000000-0x19000fff on nexus0 mdio0: <MDIO> on
> > controller> argemdio0
> > mdioproxy0: <MII/MDIO proxy, MDIO side> on mdio0
> > arswitch0: readreg    0: 12041204
> >
> 
> Use 0x08x instead of %d - that way it's more obvious what it's
> reading.
>

I used %X, just no 0x prefix... that way it would be

arswitch0: readreg 0x00000000: 0x12041204

> > Nothing else. Do you have any idea why there is only one read of
> > register at address 0? Where is this read in source? What is in this
> > register? It looks like there is expected some other value and
> > therefore AR8327 is not recognised.
> >
> > 2. AR9340 is not correctly initialised, at least I can't see any
> > traffic passing to physical port(s) - I can start dhclient arge1
> > but I see nothing at DHCP server comming from that particular MAC,
> > thus no address is beeing assigned. If I assign IP manually,
> > packets do not reach wire - nothing is seen there.
> 
> If arswitch0 doesn't create an mdiobus1, then it'll not all probe
> right. What's the current full dmesg?
> 

With regard to arswitch0, that's just it - only one readreg debug
printf and nothing more. So it looks like being rejected straight from
the beginning...

Full dmesg (with readreg/writereg debug printf output), well, up to
the point of mounting root is attached.

In OpenWrt sources, I found something interesting in the file at
https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
- it looks like the function ath79_register_mdio (lines 176 - 267)
should set mdio clock rate, and for 934x SoC it calls helper function
ar934x_get_mdio_ref_clock (lines 151 - 174). Maybe some hint could be
here, I don't know, I am not that familiar with OpenWrt sources, I just
tested here both switches are working.

Milan

[-- Attachment #2 --]
RouterBOOT booter 3.07

RouterBoard 2011UAS

CPU frequency: 600 MHz
 Memory speed: 225 MHz
  Memory size: 128 MiB
    NAND size: 128 MiB

Press any key within 2 seconds to enter setup..
trying bootp protocol... OK
Got IP address: 192.168.16.31
resolved mac address 10:BF:48:7B:14:12
Gateway: 192.168.16.1
transfer started ..................................... transfer ok, time=3.40s
setting up elf image... OK
jumping to kernel code
CPU platform: Atheros AR9344 rev 2
CPU Frequency=600 MHz
CPU DDR Frequency=450 MHz
CPU AHB Frequency=200 MHz
platform frequency: 600 MHz
CPU reference clock: 25 MHz
CPU MDIO clock: 25 MHz
arguments:
  a0 = 0000000b
  a1 = a15e2a00
  a2 = 00000000
  a3 = 00000000
Cmd line: console=ttyS0,115200 parts=1 boot_part_size=4194304 gpio=249403 HZ=300000000 mem=128M kmac=D4:CA:6D:6F:47:63 board=2011US ver=3.07 boot=1 mlc=5
Environment:
envp is invalid
Cache info:
  picache_stride    = 4096
  picache_loopcount = 16
  pdcache_stride    = 4096
  pdcache_loopcount = 8
cpu0: MIPS Technologies processor v76.151
  MMU: Standard TLB, 32 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=0xbee3519e<PerfCount,WatchRegs,MIPS16,EJTAG>
  Config3=0x2c20
Physical memory chunk(s):
0x439000 - 0x7ffffff, 129789952 bytes (31687 pages)
Maxmem is 0x8000000
ar934x_chip_init_gmac: gmac_cfg=0x00000041
ar934x_configure_gmac: ETH_CFG=0x00000001
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2014 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 11.0-CURRENT #7 r262886M: Sat Mar  8 17:06:11 CET 2014
    root@zeta.dino.sk:/data/mips/obj/mips.mips/data/src/11/sys/RB2011 mips
gcc version 4.2.1 20070831 patched [FreeBSD]
Preloaded elf kernel "kernel" at 0x80432c70.
real memory  = 134217728 (131072K bytes)
Physical memory chunk(s):
0x004cd000 - 0x07d93fff, 126644224 bytes (30919 pages)
avail memory = 126418944 (120MB)
random device not loaded; using insecure entropy
Falling back to <Software, Yarrow> random adaptor
random: <Software, Yarrow> initialized
mem: <memory>
nfslock: pseudo-device
null: <null device, zero device>
nexus0: <MIPS32 root nexus>
clock0: <Generic MIPS32 ticker> on nexus0
Timecounter "MIPS32" frequency 300000000 Hz quality 800
Event timer "MIPS32" frequency 300000000 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: readreg 0x00000000: 0x12041204
argemdio1: <Atheros AR71xx built-in ethernet interface, MDIO controller> at mem 0x1a000000-0x1a000fff on nexus0
mdio1: <MDIO> on argemdio1
mdioproxy1: <MII/MDIO proxy, MDIO side> on mdio1
arswitch1: <Atheros AR9340 Ethernet Switch> on mdio1
arswitch1: writereg 0x00000000: 0x80000000 (0x00000000)
arswitch1: readreg 0x00000000: 0x02010201
arswitch1: writereg 0x00000078: 0x000001f0 (0x00000000)
arswitch1: writereg 0x00000070: 0x0000fa50 (0x00000000)
arswitch1: writereg 0x0000005c: 0x0006002b (0x00000000)
arswitch1: readreg 0x0000003c: 0xcf000000
arswitch1: writereg 0x0000003c: 0xcf008000 (0x00000000)
arswitch1: readreg 0x0000002c: 0xfc7ecf00
arswitch1: writereg 0x0000002c: 0xfe7ecf00 (0x00000000)
arswitch1: readreg 0x0000002c: 0xfc7efc7e
arswitch1: writereg 0x0000002c: 0xfc7ffc7e (0x00000000)
arswitch1: readreg 0x00000080: 0x0000fc7e
arswitch1: writereg 0x00000080: 0x4000fc7e (0x00000000)
arswitch1: readreg 0x00000030: 0x19f00000
arswitch1: writereg 0x00000030: 0x19f00600 (0x00000000)
arswitch1: readreg 0x00000074: 0x000019f0
arswitch1: writereg 0x00000074: 0x00000000 (0x00000000)
arswitch1: ar9340_hw_global_setup: GMII
arswitch1: readreg 0x00000004: 0x00000000
arswitch1: writereg 0x00000004: 0x00000040 (0x00000000)
arswitch1: ar9340_hw_global_setup: PHY4 - Local
arswitch1: writereg 0x00000100: 0x0000007e (0x00000000)
arswitch1: readreg 0x00000104: 0x00000000
arswitch1: writereg 0x00000104: 0x00000000 (0x00000000)
arswitch1: writereg 0x00000200: 0x00000200 (0x00000000)
arswitch1: readreg 0x00000204: 0x00000000
arswitch1: writereg 0x00000204: 0x00000000 (0x00000000)
arswitch1: writereg 0x00000300: 0x00000200 (0x00000000)
arswitch1: readreg 0x00000304: 0x00000000
arswitch1: writereg 0x00000304: 0x00000000 (0x00000000)
arswitch1: writereg 0x00000400: 0x00000200 (0x00000000)
arswitch1: readreg 0x00000404: 0x00000000
arswitch1: writereg 0x00000404: 0x00000000 (0x00000000)
arswitch1: writereg 0x00000500: 0x00000200 (0x00000000)
arswitch1: readreg 0x00000504: 0x00000000
arswitch1: writereg 0x00000504: 0x00000000 (0x00000000)
arswitch1: writereg 0x00000600: 0x00000200 (0x00000000)
arswitch1: readreg 0x00000604: 0x00000000
arswitch1: writereg 0x00000604: 0x00000000 (0x00000000)
miibus0: <MII bus> on arswitch1
ukphy0: <Generic IEEE 802.3u media interface> PHY 0 on miibus0
ukphy0: OUI 0x784a2e, model 0x0004, rev. 2
arswitch1: writereg 0x00000098: 0xc0008400 (0x00000000)
arswitch1: readreg 0x00000098: 0x84008400
arswitch1: readreg 0x00000098: 0x48034803
arswitch1: writereg 0x00000098: 0xc0004003 (0x00000000)
arswitch1: readreg 0x00000098: 0x48003100
ukphy0:  none, 10baseT, 100baseTX-FDX
arswitch1: writereg 0x00000098: 0xc0040001 (0x00000000)
arswitch1: readreg 0x00000098: 0x48017949
arswitch1: writereg 0x00000098: 0xc0000400 (0x00000000)
arswitch1: readreg 0x00000098: 0x48014801
miibus1: <MII bus> on arswitch1
ukphy1: <Generic IEEE 802.3u media interface> PHY 1 on miibus1
ukphy1: OUI 0x784a7a, model 0x0014, rev. 9
arswitch1: writereg 0x00000098: 0xc0208400 (0x00000000)
arswitch1: readreg 0x00000098: 0x84008400
arswitch1: readreg 0x00000098: 0x48234823
arswitch1: writereg 0x00000098: 0xc0204023 (0x00000000)
arswitch1: readreg 0x00000098: 0x48203100
ukphy1:  none, 10baseT, 100baseTX-FDX
arswitch1: writereg 0x00000098: 0xc0240001 (0x00000000)
arswitch1: readreg 0x00000098: 0x48217949
arswitch1: writereg 0x00000098: 0xc0200400 (0x00000000)
arswitch1: readreg 0x00000098: 0x48214821
miibus2: <MII bus> on arswitch1
ukphy2: <Generic IEEE 802.3u media interface> PHY 2 on miibus2
ukphy2: OUI 0x00c802, model 0x0004, rev. 13
arswitch1: writereg 0x00000098: 0xc0408400 (0x00000000)
arswitch1: readreg 0x00000098: 0x84008400
arswitch1: readreg 0x00000098: 0x48434843
arswitch1: writereg 0x00000098: 0xc0404043 (0x00000000)
arswitch1: readreg 0x00000098: 0x48403100
ukphy2:  none, 10baseT, 100baseTX-FDX
arswitch1: writereg 0x00000098: 0xc0440001 (0x00000000)
arswitch1: readreg 0x00000098: 0x48417949
arswitch1: writereg 0x00000098: 0xc0400400 (0x00000000)
arswitch1: readreg 0x00000098: 0x48414841
miibus3: <MII bus> on arswitch1
ukphy3: <Generic IEEE 802.3u media interface> PHY 3 on miibus3
ukphy3: OUI 0x00c802, model 0x0004, rev. 13
arswitch1: writereg 0x00000098: 0xc0608400 (0x00000000)
arswitch1: readreg 0x00000098: 0x84008400
arswitch1: readreg 0x00000098: 0x48634863
arswitch1: writereg 0x00000098: 0xc0604063 (0x00000000)
arswitch1: readreg 0x00000098: 0x48603100
ukphy3:  none, 10baseT, 100baseTX-FDX
arswitch1: writereg 0x00000098: 0xc0640001 (0x00000000)
arswitch1: readreg 0x00000098: 0x48617949
arswitch1: writereg 0x00000098: 0xc0600400 (0x00000000)
arswitch1: readreg 0x00000098: 0x48614861
miibus4: <MII bus> on arswitch1
ukphy4: <Generic IEEE 802.3u media interface> PHY 4 on miibus4
ukphy4: OUI 0x784a7a, model 0x0014, rev. 9
arswitch1: writereg 0x00000098: 0xc0808400 (0x00000000)
arswitch1: readreg 0x00000098: 0x84008400
arswitch1: readreg 0x00000098: 0x48834883
arswitch1: writereg 0x00000098: 0xc0804083 (0x00000000)
arswitch1: readreg 0x00000098: 0x48803100
ukphy4:  none, 10baseT, 100baseTX-FDX
arswitch1: writereg 0x00000098: 0xc0840001 (0x00000000)
arswitch1: readreg 0x00000098: 0x48817949
arswitch1: writereg 0x00000098: 0xc0800400 (0x00000000)
arswitch1: readreg 0x00000098: 0x48814881
arswitch1: readreg 0x00000104: 0x00004881
arswitch1: writereg 0x00000104: 0x00004881 (0x00000000)
arswitch1: readreg 0x00000204: 0x00000000
arswitch1: writereg 0x00000204: 0x00000000 (0x00000000)
arswitch1: readreg 0x00000304: 0x00000000
arswitch1: writereg 0x00000304: 0x00000000 (0x00000000)
arswitch1: readreg 0x00000404: 0x00000000
arswitch1: writereg 0x00000404: 0x00000000 (0x00000000)
arswitch1: readreg 0x00000504: 0x00000000
arswitch1: writereg 0x00000504: 0x00000000 (0x00000000)
arswitch1: readreg 0x00000604: 0x00000000
arswitch1: writereg 0x00000604: 0x00000000 (0x00000000)
arswitch1: readreg 0x00000040: 0x00000000
arswitch1: writereg 0x00000040: 0x00000009 (0x00000000)
arswitch1: readreg 0x00000040: 0x00000000
arswitch1: readreg 0x00000108: 0x00010000
arswitch1: writereg 0x00000108: 0x003f0003 (0x00000000)
arswitch1: readreg 0x00000208: 0x00010001
arswitch1: writereg 0x00000208: 0x003f0003 (0x00000000)
arswitch1: readreg 0x00000308: 0x00010000
arswitch1: writereg 0x00000308: 0x003f0003 (0x00000000)
arswitch1: readreg 0x00000408: 0x00010001
arswitch1: writereg 0x00000408: 0x003f0003 (0x00000000)
arswitch1: readreg 0x00000508: 0x00010000
arswitch1: writereg 0x00000508: 0x003f0003 (0x00000000)
arswitch1: readreg 0x00000608: 0x00010001
arswitch1: writereg 0x00000608: 0x003f0003 (0x00000000)
mdio2: <MDIO> on arswitch1
mdioproxy2: <MII/MDIO proxy, MDIO side> on mdio2
etherswitch0: <Switch controller> on arswitch1
arswitch1: readreg 0x00000200: 0x12801280
arswitch1: readreg 0x00000300: 0x00000000
arswitch1: readreg 0x00000400: 0x00000000
arswitch1: readreg 0x00000500: 0x00000000
arswitch1: readreg 0x00000600: 0x00000000
apb0 at irq 4 on nexus0
uart0: <16550 or compatible> on apb0
uart0: console (115200,n,8,1)
uart0: fast interrupt
ehci0: <AR71XX Integrated USB 2.0 controller> at mem 0x1b000100-0x1b0010ff irq 1 on nexus0
usbus0: set host controller mode
usbus0: EHCI version 1.0
usbus0: set host controller mode
usbus0 on ehci0
ehci0: usbpf: Attached
spi0: <AR71XX SPI> at mem 0x1f000000-0x1f00000f on nexus0
spibus0: <spibus bus> on spi0
mx25l0: <M25Pxx Flash Family> at cs 0 on spibus0
mx25l0: w25x10, sector 65536 bytes, 2 sectors
ar71xx_wdog0: <Atheros AR71XX watchdog timer> on nexus0
arge0: <Atheros AR71xx built-in ethernet interface> at mem 0x19000000-0x19000fff irq 4 on nexus0
arge0: arge_fetch_pll_config: pll_1000 = 0x6000000
arge0: arge_attach: overriding MII mode to 'RGMII'
miiproxy0: <MII/MDIO proxy, MII side> on arge0
miiproxy0: attached to target mdio0
arge0: finishing attachment, phymask 0000, proxy set
arge0: bpf attached
arge0: Ethernet address: d4:ca:6d:6f:47:63
arge1: <Atheros AR71xx built-in ethernet interface> at mem 0x1a000000-0x1a000fff irq 3 on nexus0
arge1: arge_attach: overriding MII mode to 'GMII'
mii_attach_proxy: not attaching, no mdio device hint for arge1
arge1: finishing attachment, phymask 0000, proxy null
arge1: bpf attached
arge1: Ethernet address: d4:ca:6d:6f:47:64
Device configuration finished.
Timecounters tick every 1.000 msec
tcp_init: net.inet.tcp.tcbhashsize auto tuned to 2048
lo0: bpf attached
arswitch1: readreg 0x00000200: 0x00030003
arswitch1: readreg 0x00000300: 0x00000000
arswitch1: readreg 0x00000400: 0x00000000
arswitch1: readreg 0x00000500: 0x00000000
arswitch1: readreg 0x00000600: 0x00000000
arswitch1port1: link state changed to DOWN
arswitch1port2: link state changed to DOWN
arswitch1port3: link state changed to DOWN
arswitch1port4: link state changed to DOWN
arswitch1port5: link state changed to DOWN
GEOM: new disk flash/spi0
usbus0: 480Mbps High Speed USB v2.0
ugen0.1: <Atheros> at usbus0
uhub0: <Atheros EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
random: unblocking device.
Root mount waiting for: usbus0
uhub0: 1 port with 1 removable, self powered
arswitch1: readreg 0x00000200: 0x00030003
arswitch1: readreg 0x00000300: 0x00000000
arswitch1: readreg 0x00000400: 0x00000000
arswitch1: readreg 0x00000500: 0x00000000
arswitch1: readreg 0x00000600: 0x00000000
Root mount waiting for: usbus0
ugen0.2: <SMI Corporation> at usbus0
umass0: <SMI Corporation USB DISK, class 0/0, rev 2.00/11.00, addr 2> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x4000
umass0:0:0: Attached to scbus0
Trying to mount root from ufs:da0 []...
mountroot: waiting for device da0 ...
(probe0:umass-sim0:0:0:0): Down reving Protocol Version from 2 to 0?
GEOM: new disk da0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <USB Flash Disk 1100> Removable Direct Access SCSI-0 device
da0: Serial Number AA04012700007619
da0: 40.000MB/s transfers
da0: 1935MB (3963904 512 byte sectors: 255H 63S/T 246C)
da0: quirks=0x2<NO_6_BYTE>
da0: Delete methods: <NONE(*)>
(da0:umass-sim0:0:0:0): PREVENT ALLOW MEDIUM REMOVAL not supported.
Mounting from ufs:da0 failed with error 22.

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